コード例 #1
0
  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;
      }
    }
  }
コード例 #2
0
  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;
  }
コード例 #3
0
  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();
            }
          }
        }
      }
    }
  }