Package org.infinispan.stream.impl
Class AbstractCacheStream<Original,T,S extends BaseStream<T,S>,S2 extends S>
- java.lang.Object
-
- org.infinispan.stream.impl.AbstractCacheStream<Original,T,S,S2>
-
- Type Parameters:
Original
- the original type of the underlying stream - normally CacheEntry or ObjectT
- The type returned by the streamS
- The stream interface
- All Implemented Interfaces:
AutoCloseable
,BaseStream<T,S>
- Direct Known Subclasses:
DistributedCacheStream
,DistributedDoubleCacheStream
,DistributedIntCacheStream
,DistributedLongCacheStream
public abstract class AbstractCacheStream<Original,T,S extends BaseStream<T,S>,S2 extends S> extends Object implements BaseStream<T,S>
Abstract stream that provides all of the common functionality required for all types of Streams including the various primitive types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractCacheStream.MapOpsExternalizer
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCacheStream(Address localAddress, boolean parallel, DistributionManager dm, Supplier<CacheStream<Original>> supplier, ClusterStreamManager<Original,Object> csm, boolean includeLoader, int distributedBatchSize, Executor executor, ComponentRegistry registry, Function<? super Original,?> toKeyFunction)
protected
AbstractCacheStream(AbstractCacheStream<Original,T,S,S2> other)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addIntermediateOperation(Queue<org.infinispan.stream.impl.intops.IntermediateOperation> intermediateOperations, org.infinispan.stream.impl.intops.IntermediateOperation<T,S,?,?> intermediateOperation)
protected S2
addIntermediateOperation(org.infinispan.stream.impl.intops.IntermediateOperation<T,S,T,S> intermediateOperation)
protected void
addIntermediateOperationMap(org.infinispan.stream.impl.intops.IntermediateOperation<T,S,?,?> intermediateOperation)
void
close()
protected static Consumer<Supplier<PrimitiveIterator.OfInt>>
composeWithExceptions(Consumer<Supplier<PrimitiveIterator.OfInt>> a, Consumer<Supplier<PrimitiveIterator.OfInt>> b)
Given two SegmentCompletionListener, return a SegmentCompletionListener that executes both in sequence, even if the first throws an exception, and if both throw exceptions, add any exceptions thrown by the second as suppressed exceptions of the first.protected abstract Log
getLog()
boolean
isParallel()
protected boolean
isPrimaryOwner(ConsistentHash ch, Object key)
protected Function<? super Original,?>
nonNullKeyFunction()
S2
onClose(Runnable closeHandler)
S2
parallel()
S2
sequential()
protected Supplier<Stream<Original>>
supplierForSegments(ConsistentHash ch, org.infinispan.commons.util.IntSet targetSegments, Set<Object> excludedKeys)
protected Supplier<Stream<Original>>
supplierForSegments(ConsistentHash ch, org.infinispan.commons.util.IntSet targetSegments, Set<Object> excludedKeys, boolean usePrimary)
IfusePrimary
is true the segments are the primary segments but only those that exist in targetSegments.S2
unordered()
protected abstract S2
unwrap()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.stream.BaseStream
iterator, spliterator
-
-
-
-
Field Detail
-
intermediateOperations
protected final Queue<org.infinispan.stream.impl.intops.IntermediateOperation> intermediateOperations
-
localAddress
protected final Address localAddress
-
dm
protected final DistributionManager dm
-
supplier
protected final Supplier<CacheStream<Original>> supplier
-
csm
protected final ClusterStreamManager csm
-
executor
protected final Executor executor
-
registry
protected final ComponentRegistry registry
-
partition
protected final PartitionHandlingManager partition
-
keyPartitioner
protected final KeyPartitioner keyPartitioner
-
stateTransferLock
protected final StateTransferLock stateTransferLock
-
includeLoader
protected final boolean includeLoader
-
closeRunnable
protected Runnable closeRunnable
-
parallelDistribution
protected Boolean parallelDistribution
-
parallel
protected boolean parallel
-
rehashAware
protected boolean rehashAware
-
keysToFilter
protected Set<?> keysToFilter
-
segmentsToFilter
protected org.infinispan.commons.util.IntSet segmentsToFilter
-
distributedBatchSize
protected int distributedBatchSize
-
segmentCompletionListener
protected Consumer<Supplier<PrimitiveIterator.OfInt>> segmentCompletionListener
-
iteratorOperation
protected org.infinispan.stream.impl.AbstractCacheStream.IteratorOperation iteratorOperation
-
timeout
protected long timeout
-
timeoutUnit
protected TimeUnit timeoutUnit
-
-
Constructor Detail
-
AbstractCacheStream
protected AbstractCacheStream(Address localAddress, boolean parallel, DistributionManager dm, Supplier<CacheStream<Original>> supplier, ClusterStreamManager<Original,Object> csm, boolean includeLoader, int distributedBatchSize, Executor executor, ComponentRegistry registry, Function<? super Original,?> toKeyFunction)
-
AbstractCacheStream
protected AbstractCacheStream(AbstractCacheStream<Original,T,S,S2> other)
-
-
Method Detail
-
getLog
protected abstract Log getLog()
-
addIntermediateOperation
protected S2 addIntermediateOperation(org.infinispan.stream.impl.intops.IntermediateOperation<T,S,T,S> intermediateOperation)
-
addIntermediateOperationMap
protected void addIntermediateOperationMap(org.infinispan.stream.impl.intops.IntermediateOperation<T,S,?,?> intermediateOperation)
-
addIntermediateOperation
protected void addIntermediateOperation(Queue<org.infinispan.stream.impl.intops.IntermediateOperation> intermediateOperations, org.infinispan.stream.impl.intops.IntermediateOperation<T,S,?,?> intermediateOperation)
-
unwrap
protected abstract S2 unwrap()
-
isParallel
public boolean isParallel()
- Specified by:
isParallel
in interfaceBaseStream<Original,T>
-
sequential
public S2 sequential()
- Specified by:
sequential
in interfaceBaseStream<Original,T>
-
parallel
public S2 parallel()
- Specified by:
parallel
in interfaceBaseStream<Original,T>
-
unordered
public S2 unordered()
- Specified by:
unordered
in interfaceBaseStream<Original,T>
-
onClose
public S2 onClose(Runnable closeHandler)
- Specified by:
onClose
in interfaceBaseStream<Original,T>
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBaseStream<Original,T>
-
isPrimaryOwner
protected boolean isPrimaryOwner(ConsistentHash ch, Object key)
-
supplierForSegments
protected Supplier<Stream<Original>> supplierForSegments(ConsistentHash ch, org.infinispan.commons.util.IntSet targetSegments, Set<Object> excludedKeys)
-
supplierForSegments
protected Supplier<Stream<Original>> supplierForSegments(ConsistentHash ch, org.infinispan.commons.util.IntSet targetSegments, Set<Object> excludedKeys, boolean usePrimary)
IfusePrimary
is true the segments are the primary segments but only those that exist in targetSegments. However ifusePrimary
is false thentargetSegments
must be provided and non null and this will be used specifically.- Parameters:
ch
-targetSegments
-excludedKeys
-usePrimary
- determines whether we should utilize the primary segments or not.- Returns:
-
composeWithExceptions
protected static Consumer<Supplier<PrimitiveIterator.OfInt>> composeWithExceptions(Consumer<Supplier<PrimitiveIterator.OfInt>> a, Consumer<Supplier<PrimitiveIterator.OfInt>> b)
Given two SegmentCompletionListener, return a SegmentCompletionListener that executes both in sequence, even if the first throws an exception, and if both throw exceptions, add any exceptions thrown by the second as suppressed exceptions of the first.
-
-