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; }
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(); } } } } } }