Class AbstractAsynchronousProcessor<K,​V,​R,​T>

    • Constructor Detail

      • AbstractAsynchronousProcessor

        protected AbstractAsynchronousProcessor​(InvocableMap.EntryProcessor<K,​V,​R> processor,
                                                int iUnitOrderId)
        Construct AbstractAsynchronousProcessor instance.
        Parameters:
        processor - the underlying InvocableMap.EntryProcessor
        iUnitOrderId - the unit-of-order id for this processor
    • Method Detail

      • onResult

        public abstract void onResult​(Map.Entry<K,​R> entry)
        Called when there is a partial result of the asynchronous execution.

        For a given request, calls to this method and onException(java.lang.Throwable) may come concurrently.

        For ordering guarantees across different processor invocations see getUnitOfOrderId().

        Note: Overriding implementations of this method must be non-blocking.

        Parameters:
        entry - an entry holding the key and a result of the operation for the given key
      • onComplete

        public abstract void onComplete()
        Called after the processor has been notified about all possible partial results or failures and no more are forthcoming. As long as this processor was submitted to any of InvocableMap's methods, this method is guaranteed to be called once and only once.

        Possible call back sequences are:

          cache.invoke
            ...
            onResult
            onComplete
        
          cache.invoke
            ...
            onException
            onComplete
        
          cache.invokeAll
            ...
             onResult
             onException
             onException
             onResult
             onComplete
         
        For ordering guarantees across processors see getUnitOfOrderId().

        Note: Overriding implementations of this method must be non-blocking.

      • onException

        public abstract void onException​(Throwable eReason)
        Called if any part of the operation failed for any reason. For operations that span multiple partitions this method could be called more than once. However, unless subclasses override this method, any failure will "complete" the operation.

        Note: Overriding implementations of this method must be non-blocking.

        Parameters:
        eReason - the reason of failure
      • getProcessor

        public InvocableMap.EntryProcessor<K,​V,​R> getProcessor()
        Obtain the underlying entry processor.
        Returns:
        the underlying entry processor
      • processAll

        public Map<K,​R> processAll​(Set<? extends InvocableMap.Entry<K,​V>> setEntries)
        Not supported.
        Specified by:
        processAll in interface InvocableMap.EntryProcessor<K,​V,​R>
        Parameters:
        setEntries - a Set of InvocableMap.Entry objects to process
        Returns:
        a Map containing the results of the processing, up to one entry for each InvocableMap.Entry that was processed, keyed by the keys of the Map that were processed, with a corresponding value being the result of the processing for each key