Class LocalStreamManagerImpl<Original,​K,​V>

  • Type Parameters:
    Original - original stream type
    K - key type of underlying cache
    V - value type of underlying cache
    All Implemented Interfaces:
    LocalStreamManager<Original,​K>

    public class LocalStreamManagerImpl<Original,​K,​V>
    extends Object
    implements LocalStreamManager<Original,​K>
    Local stream manager implementation that handles injection of the stream supplier, invoking the operation and subsequently notifying the operation if a rehash has changed one of its segments.
    • Constructor Detail

      • LocalStreamManagerImpl

        public LocalStreamManagerImpl()
    • Method Detail

      • inject

        public void inject​(Cache<K,​V> cache)
        Injects the cache - unfortunately this cannot be in start. Tests will rewire certain components which will in turn reinject the cache, but they won't call the start method! If the latter is fixed we can add this to start method and add @Inject to the variable.
        Parameters:
        cache -
      • start

        public void start()
      • dataRehashed

        public void dataRehashed​(DataRehashedEvent<K,​V> event)
        We need to listen to data rehash events in case if data moves while we are iterating over it. If a rehash occurs causing this node to lose a segment and there is something iterating over the stream looking for values of that segment, we can't guarantee that the data has all been seen correctly, so we must therefore suspect that node by sending it back to the owner.
        Parameters:
        event - The data rehash event
      • streamOperation

        public <R> void streamOperation​(Object requestId,
                                        Address origin,
                                        boolean parallelStream,
                                        org.infinispan.commons.util.IntSet segments,
                                        Set<K> keysToInclude,
                                        Set<K> keysToExclude,
                                        boolean includeLoader,
                                        boolean entryStream,
                                        TerminalOperation<Original,​R> operation)
        Description copied from interface: LocalStreamManager
        Stream operation for a non key aware operation without rehash enabled.
        Specified by:
        streamOperation in interface LocalStreamManager<Original,​K>
        Type Parameters:
        R - the type of value from the operation
        Parameters:
        requestId - the originating request id
        origin - the node this request came from
        parallelStream - whether this stream is parallel or not
        segments - the segments to include in this operation
        keysToInclude - which keys to include
        keysToExclude - which keys to exclude
        includeLoader - whether or not a cache loader should be utilized
        operation - the operation to perform
      • streamOperationRehashAware

        public <R> void streamOperationRehashAware​(Object requestId,
                                                   Address origin,
                                                   boolean parallelStream,
                                                   org.infinispan.commons.util.IntSet segments,
                                                   Set<K> keysToInclude,
                                                   Set<K> keysToExclude,
                                                   boolean includeLoader,
                                                   boolean entryStream,
                                                   TerminalOperation<Original,​R> operation)
        Description copied from interface: LocalStreamManager
        Stream operation for a non key aware operation with rehash enabled.
        Specified by:
        streamOperationRehashAware in interface LocalStreamManager<Original,​K>
        Type Parameters:
        R - the type of value from the operation
        Parameters:
        requestId - the originating request id
        origin - the node this request came from
        parallelStream - whether this stream is parallel or not
        segments - the segments to include in this operation
        keysToInclude - which keys to include
        keysToExclude - which keys to exclude
        includeLoader - whether or not a cache loader should be utilized
        operation - the operation to perform
      • streamOperation

        public <R> void streamOperation​(Object requestId,
                                        Address origin,
                                        boolean parallelStream,
                                        org.infinispan.commons.util.IntSet segments,
                                        Set<K> keysToInclude,
                                        Set<K> keysToExclude,
                                        boolean includeLoader,
                                        boolean entryStream,
                                        KeyTrackingTerminalOperation<Original,​K,​R> operation)
        Description copied from interface: LocalStreamManager
        Stream operation for a key aware operation without rehash enabled
        Specified by:
        streamOperation in interface LocalStreamManager<Original,​K>
        Type Parameters:
        R - the type of value from the operation
        Parameters:
        requestId - the originating request id
        origin - the node this request came from
        parallelStream - whether this stream is parallel or not
        segments - the segments to include in this operation
        keysToInclude - which keys to include
        keysToExclude - which keys to exclude
        includeLoader - whether or not a cache loader should be utilized
        operation - the operation to perform
      • streamOperationRehashAware

        public void streamOperationRehashAware​(Object requestId,
                                               Address origin,
                                               boolean parallelStream,
                                               org.infinispan.commons.util.IntSet segments,
                                               Set<K> keysToInclude,
                                               Set<K> keysToExclude,
                                               boolean includeLoader,
                                               boolean entryStream,
                                               KeyTrackingTerminalOperation<Original,​K,​?> operation)
        Description copied from interface: LocalStreamManager
        Stream operation for a key aware operation with rehash enabled
        Specified by:
        streamOperationRehashAware in interface LocalStreamManager<Original,​K>
        Parameters:
        requestId - the originating request id
        origin - the node this request came from
        parallelStream - whether this stream is parallel or not
        segments - the segments to include in this operation
        keysToInclude - which keys to include
        keysToExclude - which keys to exclude
        includeLoader - whether or not a cache loader should be utilized
        operation - the operation to perform
      • startIterator

        public IteratorResponse startIterator​(Object requestId,
                                              Address origin,
                                              org.infinispan.commons.util.IntSet segments,
                                              Set<K> keysToInclude,
                                              Set<K> keysToExclude,
                                              boolean includeLoader,
                                              boolean entryStream,
                                              Iterable<IntermediateOperation> intermediateOperations,
                                              long batchSize)
        Description copied from interface: LocalStreamManager
        Signals that a new iterator is created using the given arguments. Returns a response which only returns the given batchSize worth of elements.
        Specified by:
        startIterator in interface LocalStreamManager<Original,​K>
        Parameters:
        requestId - the originating request id
        origin - the node this request came from
        segments - the segments to include in this operation
        keysToInclude - which keys to include
        keysToExclude - which keys to exclude
        includeLoader - whether or not a cache loader should be utilized
        intermediateOperations - the operations to apply to the underlying data
        batchSize - how many elements to return
        Returns:
        the response containing iterator
      • continueIterator

        public IteratorResponse continueIterator​(Object requestId,
                                                 long batchSize)
        Description copied from interface: LocalStreamManager
        Continues an existing iterator by retrieving the next batchSize of elements
        Specified by:
        continueIterator in interface LocalStreamManager<Original,​K>
        Parameters:
        requestId - the originating request id
        batchSize - how many elements to return
        Returns:
        the response containing iterator