Class StreamingAsynchronousProcessor<K,​V,​R>

  • Type Parameters:
    K - the type of the Map entry key
    V - the type of the Map entry value
    R - the type of value returned by the EntryProcessor
    All Implemented Interfaces:
    FlowControl, InvocableMap.EntryProcessor<K,​V,​R>, Serializable, Future<Void>

    public class StreamingAsynchronousProcessor<K,​V,​R>
    extends AbstractAsynchronousProcessor<K,​V,​R,​Void>
    An EntryProcessor wrapper class that allows for an asynchronous invocation of the underlying processor. Unlike AsynchronousProcessor, this implementation does not collect the results of the underlying entry processor execution, but simply streams partial results to the provided partial results callback.

    This allows for a much lower memory overhead if the complete result set does not to be realized on the client.

    It's very important that the overriding implementations of onComplete(), onResult(java.util.Map.Entry<K, R>) and onException(java.lang.Throwable), and provided callbacks must be non-blocking. For example, any use of NamedCache API is completely disallowed, with the only exception of asynchronous agents with disabled flow control.

    The underlying entry processor is guaranteed to have been fully executed when onComplete() is called.

    Note 1: Neither this class nor its extensions need to be serializable. Only the underlying processor is serialized and sent to corresponding servers for execution.
    Note 2: This feature is not available on Coherence*Extend clients.

    Author:
    as 2015.01.28
    See Also:
    AsynchronousProcessor, SingleEntryAsynchronousProcessor, Serialized Form
    • Field Detail

      • f_onPartial

        protected final Consumer<? super Map.Entry<? extends K,​? extends R>> f_onPartial
        The user-provided callback that will be invoked for each partial result.
    • Constructor Detail

      • StreamingAsynchronousProcessor

        public StreamingAsynchronousProcessor​(InvocableMap.EntryProcessor<K,​V,​R> processor,
                                              Consumer<? super Map.Entry<? extends K,​? extends R>> onPartial)
        Construct a StreamingAsynchronousProcessor for a given processor and one or more callbacks.

        Important Note: All provided callbacks must be non-blocking. For example, any use of NamedCache API is completely disallowed.

        Parameters:
        processor - the underlying InvocableMap.EntryProcessor
        onPartial - a user-defined callback that will be called for each partial result
      • StreamingAsynchronousProcessor

        public StreamingAsynchronousProcessor​(InvocableMap.EntryProcessor<K,​V,​R> processor,
                                              Consumer<? super Map.Entry<? extends K,​? extends R>> onPartial,
                                              Executor executor)
        Construct a StreamingAsynchronousProcessor for a given processor and one or more callbacks.

        Important Note: All provided callbacks must be non-blocking. For example, any use of NamedCache API is completely disallowed.

        Parameters:
        processor - the underlying InvocableMap.EntryProcessor
        onPartial - a user-defined callback that will be called for each partial result
        executor - an optional Executor to complete the future on, if not provided the Daemons.commonPool() is used
      • StreamingAsynchronousProcessor

        public StreamingAsynchronousProcessor​(InvocableMap.EntryProcessor<K,​V,​R> processor,
                                              int iUnitOrderId,
                                              Consumer<? super Map.Entry<? extends K,​? extends R>> onPartial)
        Construct a StreamingAsynchronousProcessor for a given processor and one or more callbacks.

        Important Note: All provided callbacks must be non-blocking. For example, any use of NamedCache API is completely disallowed.

        Parameters:
        processor - the underlying InvocableMap.EntryProcessor
        iUnitOrderId - the unit-of-order id for this processor
        onPartial - a user-defined callback that will be called for each partial result
      • StreamingAsynchronousProcessor

        public StreamingAsynchronousProcessor​(InvocableMap.EntryProcessor<K,​V,​R> processor,
                                              int iUnitOrderId,
                                              Consumer<? super Map.Entry<? extends K,​? extends R>> onPartial,
                                              Executor executor)
        Construct a StreamingAsynchronousProcessor for a given processor and one or more callbacks.

        Important Note: All provided callbacks must be non-blocking. For example, any use of NamedCache API is completely disallowed.

        Parameters:
        processor - the underlying InvocableMap.EntryProcessor
        iUnitOrderId - the unit-of-order id for this processor
        onPartial - a user-defined callback that will be called for each partial result
        executor - an optional Executor to complete the future on, if not provided the Daemons.commonPool() is used