/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
protected void terminated() { shutdownListenable.shutdown(); }
protected void terminated() { shutdownListenable.shutdown(); }
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
/** {@inheritDoc} */ public void shutdown() { boolean callShutdownListener = false; final Lock lock = this.lock; lock.lock(); try { if (! stop) { stop = true; // wake up the whole town removeCondition.signalAll(); enqueueCondition.signalAll(); if (workers.isEmpty()) { callShutdownListener = true; } else { for (Thread worker : workers) { worker.interrupt(); } } } } finally { lock.unlock(); if (callShutdownListener) shutdownListenable.shutdown(); } }
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
/** {@inheritDoc} */ public List<Runnable> shutdownNow() { boolean callShutdownListener = false; final Lock lock = this.lock; lock.lock(); try { stop = true; removeCondition.signalAll(); enqueueCondition.signalAll(); if (workers.isEmpty()) { callShutdownListener = true; } else { for (Thread worker : workers) { worker.interrupt(); } } final Queue<Runnable> queue = this.queue; final ArrayList<Runnable> list = new ArrayList<Runnable>(queue); queue.clear(); return list; } finally { lock.unlock(); if (callShutdownListener) shutdownListenable.shutdown(); } }
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
public void shutdown() { boolean callShutdownListener = false; final Lock lock = this.lock; lock.lock(); try { if (! stop) { if (runningThreads.isEmpty()) { callShutdownListener = true; } else { for (Thread runningThread : runningThreads) { runningThread.interrupt(); } } } stop = true; // wake up all waiters runnableDequeued.signalAll(); nextReady.signalAll(); workerDequeued.signalAll(); taskEnqueued.signalAll(); } finally { lock.unlock(); if (callShutdownListener) shutdownListenable.shutdown(); } }
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
shutdownListenable.shutdown();
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
shutdownListenable.shutdown();
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
protected void terminated() { shutdownListenable.shutdown(); }
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
protected void terminated() { shutdownListenable.shutdown(); }
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }
protected void terminated() { shutdownListenable.shutdown(); }
/** {@inheritDoc} */ public <A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) { shutdownListenable.addShutdownListener(shutdownListener, attachment); }