@Override @SuppressWarnings("unchecked") public void stop() { if (started.compareAndSet(true, false)) { if (parent != null) { parent.removeChild(this); } // clear down any callbacks usageLock.writeLock().lock(); try { waitForSpaceCondition.signalAll(); for (Runnable callback : this.callbacks) { callback.run(); } this.callbacks.clear(); } finally { usageLock.writeLock().unlock(); } for (T t : children) { t.stop(); } } }
@Override @SuppressWarnings("unchecked") public void stop() { if (started.compareAndSet(true, false)) { if (parent != null) { parent.removeChild(this); } // clear down any callbacks usageLock.writeLock().lock(); try { waitForSpaceCondition.signalAll(); for (Runnable callback : this.callbacks) { callback.run(); } this.callbacks.clear(); } finally { usageLock.writeLock().unlock(); } for (T t : children) { t.stop(); } } }
@SuppressWarnings("unchecked") public void stop() { if (started.compareAndSet(true, false)){ if (parent != null) { parent.removeChild(this); } //clear down any callbacks synchronized (usageMutex) { usageMutex.notifyAll(); for (Iterator<Runnable> iter = new ArrayList<Runnable>(this.callbacks).iterator(); iter.hasNext();) { Runnable callback = iter.next(); callback.run(); } this.callbacks.clear(); } for (T t:children) { t.stop(); } } }
@Override @SuppressWarnings("unchecked") public void stop() { if (started.compareAndSet(true, false)) { if (parent != null) { parent.removeChild(this); } // clear down any callbacks usageLock.writeLock().lock(); try { waitForSpaceCondition.signalAll(); for (Runnable callback : this.callbacks) { callback.run(); } this.callbacks.clear(); } finally { usageLock.writeLock().unlock(); } for (T t : children) { t.stop(); } } }
@Override @SuppressWarnings("unchecked") public void stop() { if (started.compareAndSet(true, false)) { if (parent != null) { parent.removeChild(this); } // clear down any callbacks usageLock.writeLock().lock(); try { waitForSpaceCondition.signalAll(); for (Runnable callback : this.callbacks) { callback.run(); } this.callbacks.clear(); } finally { usageLock.writeLock().unlock(); } for (T t : children) { t.stop(); } } }