protected void disposeLockingSynchronizers() {
    Map<Object, LockingSynchronizer> lockingSynchronizers = this.lockingSynchronizers;

    if (lockingSynchronizers != null) {
      synchronized (lockingSynchronizers) {
        Collection<LockingSynchronizer> v = lockingSynchronizers.values();
        if (v != null) {
          for (LockingSynchronizer synchronizer : v) {
            synchronizer.dispose();
          }
        }

        this.lockingSynchronizers.clear();
        this.lockingSynchronizers = null;
      }
    }
  }
  public synchronized boolean awaitShutdown(long timeout) throws InterruptedException {
    boolean res = false;

    {
      long t0 = System.currentTimeMillis();
      long t1 = t0 + timeout;

      long timeoutLeft = timeout;

      // Await shutdown of the executing synchronizer:
      {
        if (executingSynchronizer != null) {
          executingSynchronizer.awaitShutdown(timeoutLeft);
        }
      }

      // Await shutdown of the locking synchronizers:
      {
        if (lockingSynchronizers != null) {
          synchronized (lockingSynchronizers) {
            Collection<LockingSynchronizer> v = lockingSynchronizers.values();
            if (v != null) {
              for (LockingSynchronizer synchronizer : v) {
                long t = System.currentTimeMillis();
                timeoutLeft = t1 - t;
                if (timeoutLeft <= 0) {
                  break;
                } else {
                  synchronizer.awaitShutdown(timeoutLeft);
                }
              }
            }
          }
        }
      }
    }

    return res;
  }
  protected Handle executeIndirectly(Object entity, Executable e, SynchronizerListener l) {
    Handle res = null;

    {
      Handle handle = null;

      LockingSynchronizer synchronizer = null;

      synchronized (lockingSynchronizers) // first lock upon 'lockingSynchronizers'!
      {
        synchronizer = getLockingSynchronizer(entity);

        handle = synchronizer.queueExecutable(entity, e, l); // second lock upon 'synchronizer'!
      }

      handle = synchronizer.ensureQueueProcessing(handle);

      res = new ExecuteHandle(handle, entity, e);
    }

    return res;
  }
  public synchronized void shutdown() {
    // Shutdown the executing synchronizer:
    {
      if (executingSynchronizer != null) {
        executingSynchronizer.shutdown();
      }
    }

    // Shutdown the locking synchronizers:
    {
      Map<Object, LockingSynchronizer> lockingSynchronizers = this.lockingSynchronizers;

      if (lockingSynchronizers != null) {
        synchronized (lockingSynchronizers) {
          Collection<LockingSynchronizer> v = lockingSynchronizers.values();
          if (v != null) {
            for (LockingSynchronizer synchronizer : v) {
              synchronizer.shutdown();
            }
          }
        }
      }
    }
  }