Class TxClusterStreamManager<Original,​K>

  • Type Parameters:
    K - the key type
    All Implemented Interfaces:
    ClusterStreamManager<Original,​K>

    public class TxClusterStreamManager<Original,​K>
    extends Object
    implements ClusterStreamManager<Original,​K>
    This is a delegating cluster stream manager that sends all calls to the underlying cluster stream manager. However in the case of performing an operation it adds all entries that are in the provided tx context to the map of keys to exclude so those values are not processed in the remote nodes.
    • Method Detail

      • remoteStreamOperation

        public <R> Object remoteStreamOperation​(boolean parallelDistribution,
                                                boolean parallelStream,
                                                ConsistentHash ch,
                                                org.infinispan.commons.util.IntSet segments,
                                                Set<K> keysToInclude,
                                                Map<Integer,​Set<K>> keysToExclude,
                                                boolean includeLoader,
                                                boolean entryStream,
                                                TerminalOperation<Original,​R> operation,
                                                ClusterStreamManager.ResultsCallback<R> callback,
                                                Predicate<? super R> earlyTerminatePredicate)
        Description copied from interface: ClusterStreamManager
        Performs the remote stream operation without rehash awareness.
        Specified by:
        remoteStreamOperation in interface ClusterStreamManager<Original,​K>
        Type Parameters:
        R - the type of response
        Parameters:
        parallelDistribution - whether or not parallel distribution is enabled
        parallelStream - whether or not the stream is paralllel
        ch - the consistent hash to use when determining segment ownership
        segments - the segments that this request should utilize
        keysToInclude - which keys to include in the request
        keysToExclude - which keys to exclude in the request
        includeLoader - whether or not to use a loader
        entryStream - whether the remote stream should be an entry or key stream
        operation - the actual operation to perform
        callback - the callback to collect individual node results
        earlyTerminatePredicate - a predicate to determine if this operation should stop based on intermediate results
        Returns:
        the operation id to be used for further calls
      • remoteStreamOperationRehashAware

        public <R> Object remoteStreamOperationRehashAware​(boolean parallelDistribution,
                                                           boolean parallelStream,
                                                           ConsistentHash ch,
                                                           org.infinispan.commons.util.IntSet segments,
                                                           Set<K> keysToInclude,
                                                           Map<Integer,​Set<K>> keysToExclude,
                                                           boolean includeLoader,
                                                           boolean entryStream,
                                                           TerminalOperation<Original,​R> operation,
                                                           ClusterStreamManager.ResultsCallback<R> callback,
                                                           Predicate<? super R> earlyTerminatePredicate)
        Description copied from interface: ClusterStreamManager
        Performs the remote stream operation with rehash awareness.
        Specified by:
        remoteStreamOperationRehashAware in interface ClusterStreamManager<Original,​K>
        Type Parameters:
        R - the type of response
        Parameters:
        parallelDistribution - whether or not parallel distribution is enabled
        parallelStream - whether or not the stream is paralllel
        ch - the consistent hash to use when determining segment ownership
        segments - the segments that this request should utilize
        keysToInclude - which keys to include in the request
        keysToExclude - which keys to exclude in the request
        includeLoader - whether or not to use a loader
        entryStream - whether the remote stream should be an entry or key stream
        operation - the actual operation to perform
        callback - the callback to collect individual node results
        earlyTerminatePredicate - a predicate to determine if this operation should stop based on intermediate results
        Returns:
        the operation id to be used for further calls
      • remoteStreamOperation

        public <R> Object remoteStreamOperation​(boolean parallelDistribution,
                                                boolean parallelStream,
                                                ConsistentHash ch,
                                                org.infinispan.commons.util.IntSet segments,
                                                Set<K> keysToInclude,
                                                Map<Integer,​Set<K>> keysToExclude,
                                                boolean includeLoader,
                                                boolean entryStream,
                                                KeyTrackingTerminalOperation<Original,​K,​R> operation,
                                                ClusterStreamManager.ResultsCallback<Collection<R>> callback)
        Description copied from interface: ClusterStreamManager
        Key tracking remote operation that doesn't have rehash enabled.
        Specified by:
        remoteStreamOperation in interface ClusterStreamManager<Original,​K>
        Type Parameters:
        R - the type of response
        Parameters:
        parallelDistribution - whether or not parallel distribution is enabled
        parallelStream - whether or not the stream is paralllel
        ch - the consistent hash to use when determining segment ownership
        segments - the segments that this request should utilize
        keysToInclude - which keys to include in the request
        keysToExclude - which keys to exclude in the request
        includeLoader - whether or not to use a loader
        entryStream - whether the remote stream should be an entry or key stream
        operation - the actual operation to perform
        callback - the callback to collect individual node results
        Returns:
        the operation id to be used for further calls
      • remoteStreamOperationRehashAware

        public Object remoteStreamOperationRehashAware​(boolean parallelDistribution,
                                                       boolean parallelStream,
                                                       ConsistentHash ch,
                                                       org.infinispan.commons.util.IntSet segments,
                                                       Set<K> keysToInclude,
                                                       Map<Integer,​Set<K>> keysToExclude,
                                                       boolean includeLoader,
                                                       boolean entryStream,
                                                       KeyTrackingTerminalOperation<Original,​K,​?> operation,
                                                       ClusterStreamManager.ResultsCallback<Collection<K>> callback)
        Description copied from interface: ClusterStreamManager
        Key tracking remote operation that has rehash enabled
        Specified by:
        remoteStreamOperationRehashAware in interface ClusterStreamManager<Original,​K>
        Parameters:
        parallelDistribution - whether or not parallel distribution is enabled
        parallelStream - whether or not the stream is paralllel
        ch - the consistent hash to use when determining segment ownership
        segments - the segments that this request should utilize
        keysToInclude - which keys to include in the request
        keysToExclude - which keys to exclude in the request
        includeLoader - whether or not to use a loader
        entryStream - whether the remote stream should be an entry or key stream
        operation - the actual operation to perform
        callback - the callback to collect individual node results
        Returns:
        the operation id to be used for further calls
      • isComplete

        public boolean isComplete​(Object id)
        Description copied from interface: ClusterStreamManager
        Tests whether this operation is still pending or not.
        Specified by:
        isComplete in interface ClusterStreamManager<Original,​K>
        Parameters:
        id - the id of the operation that was returned from the invocation
        Returns:
        whether or not it is completed
      • awaitCompletion

        public boolean awaitCompletion​(Object id,
                                       long time,
                                       TimeUnit unit)
                                throws InterruptedException
        Description copied from interface: ClusterStreamManager
        Awaits completion of the given request. Returns true when the request completes otherwise returns false after the time elapses
        Specified by:
        awaitCompletion in interface ClusterStreamManager<Original,​K>
        Parameters:
        id - the ide of the operation that was returned from the invocation - must be non null
        time - how long to wait before returning false - must be greater than 0
        unit - controls how long the time wait is
        Returns:
        whether or not the request is complete
        Throws:
        InterruptedException
      • forgetOperation

        public void forgetOperation​(Object id)
        Description copied from interface: ClusterStreamManager
        Frees any resources related to this operation and signals to any ongoing remote operations to no longer continue processing
        Specified by:
        forgetOperation in interface ClusterStreamManager<Original,​K>
        Parameters:
        id - the ide of the operation that was returned from the invocation - can be null in which case this is a noop
      • receiveResponse

        public <R1> boolean receiveResponse​(Object id,
                                            Address origin,
                                            boolean complete,
                                            org.infinispan.commons.util.IntSet segments,
                                            R1 response)
        Description copied from interface: ClusterStreamManager
        Receives a response for a given request
        Specified by:
        receiveResponse in interface ClusterStreamManager<Original,​K>
        Type Parameters:
        R1 - The type of the response
        Parameters:
        id - The request id
        origin - The origin of the response
        complete - Whether or not this is a completed response
        segments - The segments that were suspected
        response - The actual response value
        Returns:
        Whether or not the operation should continue operating, only valid if complete was false