Package org.symphonyoss.s2.canon.runtime
Class AsynchronousProducer<V>
- java.lang.Object
-
- org.symphonyoss.s2.canon.runtime.SynchronousProducer<V>
-
- org.symphonyoss.s2.canon.runtime.AsynchronousProducer<V>
-
- Type Parameters:
V- The listener payload
- All Implemented Interfaces:
IProducer<V>,IProducerImpl<V>
public class AsynchronousProducer<V> extends SynchronousProducer<V>
An implementation of IProducer which calls listeners from a Cached Thread Pool. If listener implementations block then there may be performance issues so they should not do so, but they need not be thread safe.- Author:
- Bruce Skingle
-
-
Constructor Summary
Constructors Constructor Description AsynchronousProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisShutdown()Returnstrueif this AsynchronousProducer has been shut down.protected voidnotify(org.symphonyoss.s2.fugue.pipeline.IConsumer<V> listener, V value, org.symphonyoss.s2.fugue.core.trace.ITraceContext trace)voidshutdown()Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.List<Runnable>shutdownNow()Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.-
Methods inherited from class org.symphonyoss.s2.canon.runtime.SynchronousProducer
addListener, produce, removeListener
-
-
-
-
Method Detail
-
notify
protected void notify(org.symphonyoss.s2.fugue.pipeline.IConsumer<V> listener, V value, org.symphonyoss.s2.fugue.core.trace.ITraceContext trace)
- Overrides:
notifyin classSynchronousProducer<V>
-
shutdown
public void shutdown()
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.This method does not wait for previously submitted tasks to complete execution.
- Throws:
SecurityException- if a security manager exists and shutting down this ExecutorService may manipulate threads that the caller is not permitted to modify because it does not holdRuntimePermission("modifyThread"), or the security manager'scheckAccessmethod denies access.
-
shutdownNow
public List<Runnable> shutdownNow()
Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.This method does not wait for actively executing tasks to terminate.
There are no guarantees beyond best-effort attempts to stop processing actively executing tasks. For example, typical implementations will cancel via
Thread.interrupt(), so any task that fails to respond to interrupts may never terminate.- Returns:
- list of tasks that never commenced execution
- Throws:
SecurityException- if a security manager exists and shutting down this ExecutorService may manipulate threads that the caller is not permitted to modify because it does not holdRuntimePermission("modifyThread"), or the security manager'scheckAccessmethod denies access.
-
isShutdown
public boolean isShutdown()
Returnstrueif this AsynchronousProducer has been shut down.- Returns:
trueif this AsynchronousProducer has been shut down
-
-