Class 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 Detail

      • AsynchronousProducer

        public AsynchronousProducer()
    • 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:
        notify in class SynchronousProducer<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 hold RuntimePermission("modifyThread"), or the security manager's checkAccess method 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 hold RuntimePermission("modifyThread"), or the security manager's checkAccess method denies access.
      • isShutdown

        public boolean isShutdown()
        Returns true if this AsynchronousProducer has been shut down.
        Returns:
        true if this AsynchronousProducer has been shut down