Class IntermediateIntCacheStream
- All Implemented Interfaces:
AutoCloseable,BaseStream<Integer,,IntStream> IntStream,BaseCacheStream<Integer,,IntStream> IntCacheStream
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.BaseCacheStream
BaseCacheStream.SegmentCompletionListenerNested classes/interfaces inherited from interface java.util.stream.IntStream
IntStream.Builder -
Constructor Summary
ConstructorsConstructorDescriptionIntermediateIntCacheStream(BaseCacheStream remoteStream, IntermediateType type, org.infinispan.stream.impl.local.LocalIntCacheStream localIntStream, org.infinispan.stream.impl.IntermediateCacheStreamSupplier supplier) IntermediateIntCacheStream(DistributedIntCacheStream remoteStream) -
Method Summary
Modifier and TypeMethodDescriptionbooleanallMatch(IntPredicate predicate) booleananyMatch(IntPredicate predicate) average()boxed()voidclose()<R> Rcollect(Supplier<R> supplier, ObjIntConsumer<R> accumulator, BiConsumer<R, R> combiner) longcount()Disables tracking of rehash events that could occur to the underlying cache.distinct()distributedBatchSize(int batchSize) Controls how many keys are returned from a remote node when using a stream terminal operation with a distributed cache to back this stream.filter(IntPredicate predicate) filterKeys(Set<?> keys) Filters which entries are returned by only returning ones that map to the given key.filterKeySegments(Set<Integer> segments) Filters which entries are returned by what segment they are present in.filterKeySegments(IntSet segments) Filters which entries are returned by what segment they are present in.findAny()flatMap(IntFunction<? extends IntStream> mapper) voidforEach(IntConsumer action) <K,V> void forEach(ObjIntConsumer<Cache<K, V>> action) Same asIntStream.forEach(IntConsumer)except that it takes anObjIntConsumerthat provides access to the underlyingCachethat is backing this stream.voidforEachOrdered(IntConsumer action) booleaniterator()limit(long maxSize) map(IntUnaryOperator mapper) mapToDouble(IntToDoubleFunction mapper) mapToLong(IntToLongFunction mapper) <U> CacheStream<U>mapToObj(IntFunction<? extends U> mapper) max()min()booleannoneMatch(IntPredicate predicate) parallel()This would enable sending requests to all other remote nodes when a terminal operator is performed.peek(IntConsumer action) intreduce(int identity, IntBinaryOperator op) Allows registration of a segment completion listener that is notified when a segment has completed processing.This would disable sending requests to all other remote nodes compared to one at a time.skip(long n) sorted()intsum()Sets a given time to wait for a remote operation to respond by.int[]toArray()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
IntermediateIntCacheStream
-
IntermediateIntCacheStream
public IntermediateIntCacheStream(BaseCacheStream remoteStream, IntermediateType type, org.infinispan.stream.impl.local.LocalIntCacheStream localIntStream, org.infinispan.stream.impl.IntermediateCacheStreamSupplier supplier)
-
-
Method Details
-
sequentialDistribution
Description copied from interface:IntCacheStreamThis would disable sending requests to all other remote nodes compared to one at a time. This can reduce memory pressure on the originator node at the cost of performance.Parallel distribution is enabled by default except for
CacheStream.iterator()andCacheStream.spliterator()- Specified by:
sequentialDistributionin interfaceBaseCacheStream<Integer,IntStream> - Specified by:
sequentialDistributionin interfaceIntCacheStream- Returns:
- a stream with parallel distribution disabled.
-
parallelDistribution
Description copied from interface:BaseCacheStreamThis would enable sending requests to all other remote nodes when a terminal operator is performed. This requires additional overhead as it must process results concurrently from various nodes, but should perform faster in the majority of cases.Parallel distribution is enabled by default except for
CacheStream.iterator()andCacheStream.spliterator()- Specified by:
parallelDistributionin interfaceBaseCacheStream<Integer,IntStream> - Specified by:
parallelDistributionin interfaceIntCacheStream- Returns:
- a stream with parallel distribution enabled.
-
filterKeySegments
Description copied from interface:IntCacheStreamFilters which entries are returned by what segment they are present in. This method can be substantially more efficient than using a regularCacheStream.filter(Predicate)method as this can control what nodes are asked for data and what entries are read from the underlying CacheStore if present.- Specified by:
filterKeySegmentsin interfaceBaseCacheStream<Integer,IntStream> - Specified by:
filterKeySegmentsin interfaceIntCacheStream- Parameters:
segments- The segments to use for this stream operation. Any segments not in this set will be ignored.- Returns:
- a stream with the segments filtered.
-
filterKeySegments
Description copied from interface:BaseCacheStreamFilters which entries are returned by what segment they are present in. This method can be substantially more efficient than using a regularCacheStream.filter(Predicate)method as this can control what nodes are asked for data and what entries are read from the underlying CacheStore if present.- Specified by:
filterKeySegmentsin interfaceBaseCacheStream<Integer,IntStream> - Parameters:
segments- The segments to use for this stream operation. Any segments not in this set will be ignored.- Returns:
- a stream with the segments filtered.
-
filterKeys
Description copied from interface:IntCacheStreamFilters which entries are returned by only returning ones that map to the given key. This method will be faster than a regularCacheStream.filter(Predicate)if the filter is holding references to the same keys.- Specified by:
filterKeysin interfaceBaseCacheStream<Integer,IntStream> - Specified by:
filterKeysin interfaceIntCacheStream- Parameters:
keys- The keys that this stream will only operate on.- Returns:
- a stream with the keys filtered.
-
distributedBatchSize
Description copied from interface:IntCacheStreamControls how many keys are returned from a remote node when using a stream terminal operation with a distributed cache to back this stream. This value is ignored when terminal operators that don't track keys are used. Key tracking terminal operators areCacheStream.iterator(),CacheStream.spliterator(),CacheStream.forEach(Consumer). Please see those methods for additional information on how this value may affect them.This value may be used in the case of a a terminal operator that doesn't track keys if an intermediate operation is performed that requires bringing keys locally to do computations. Examples of such intermediate operations are
CacheStream.sorted(),CacheStream.sorted(Comparator),CacheStream.distinct(),CacheStream.limit(long),CacheStream.skip(long)This value is always ignored when this stream is backed by a cache that is not distributed as all values are already local.
- Specified by:
distributedBatchSizein interfaceBaseCacheStream<Integer,IntStream> - Specified by:
distributedBatchSizein interfaceIntCacheStream- Parameters:
batchSize- The size of each batch. This defaults to the state transfer chunk size.- Returns:
- a stream with the batch size updated
-
segmentCompletionListener
Description copied from interface:IntCacheStreamAllows registration of a segment completion listener that is notified when a segment has completed processing. If the terminal operator has a short circuit this listener may never be called.This method is designed for the sole purpose of use with the
CacheStream.iterator()to allow for a user to track completion of segments as they are returned from the iterator. Behavior of other methods is not specified. Please seeCacheStream.iterator()for more information.Multiple listeners may be registered upon multiple invocations of this method. The ordering of notified listeners is not specified.
This is only used if this stream did not invoke
BaseCacheStream.disableRehashAware()and has no flat map based operations. If this is done no segments will be notified.- Specified by:
segmentCompletionListenerin interfaceBaseCacheStream<Integer,IntStream> - Specified by:
segmentCompletionListenerin interfaceIntCacheStream- Parameters:
listener- The listener that will be called back as segments are completed.- Returns:
- a stream with the listener registered.
-
disableRehashAware
Description copied from interface:IntCacheStreamDisables tracking of rehash events that could occur to the underlying cache. If a rehash event occurs while a terminal operation is being performed it is possible for some values that are in the cache to not be found. Note that you will never have an entry duplicated when rehash awareness is disabled, only lost values.Most terminal operations will run faster with rehash awareness disabled even without a rehash occuring. However if a rehash occurs with this disabled be prepared to possibly receive only a subset of values.
- Specified by:
disableRehashAwarein interfaceBaseCacheStream<Integer,IntStream> - Specified by:
disableRehashAwarein interfaceIntCacheStream- Returns:
- a stream with rehash awareness disabled.
-
timeout
Description copied from interface:IntCacheStreamSets a given time to wait for a remote operation to respond by. This timeout does nothing if the terminal operation does not go remote.If a timeout does occur then a
TimeoutExceptionis thrown from the terminal operation invoking thread or on the next call to theIteratororSpliterator.Note that if a rehash occurs this timeout value is reset for the subsequent retry if rehash aware is enabled.
- Specified by:
timeoutin interfaceBaseCacheStream<Integer,IntStream> - Specified by:
timeoutin interfaceIntCacheStream- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- a stream with the timeout set
-
isParallel
public boolean isParallel()- Specified by:
isParallelin interfaceBaseStream<Integer,IntStream>
-
sorted
Description copied from interface:IntCacheStream- Specified by:
sortedin interfaceIntCacheStream- Specified by:
sortedin interfaceIntStream- Returns:
- the new cache int stream
-
limit
Description copied from interface:IntCacheStream- Specified by:
limitin interfaceIntCacheStream- Specified by:
limitin interfaceIntStream- Returns:
- the new cache int stream
-
skip
Description copied from interface:IntCacheStream- Specified by:
skipin interfaceIntCacheStream- Specified by:
skipin interfaceIntStream- Returns:
- the new cache int stream
-
peek
Description copied from interface:IntCacheStream- Specified by:
peekin interfaceIntCacheStream- Specified by:
peekin interfaceIntStream- Returns:
- the new cache int stream
-
distinct
Description copied from interface:IntCacheStream- Specified by:
distinctin interfaceIntCacheStream- Specified by:
distinctin interfaceIntStream- Returns:
- the new cache int stream
-
filter
Description copied from interface:IntCacheStream- Specified by:
filterin interfaceIntCacheStream- Specified by:
filterin interfaceIntStream- Returns:
- the new cache int stream
-
map
Description copied from interface:IntCacheStream- Specified by:
mapin interfaceIntCacheStream- Specified by:
mapin interfaceIntStream- Returns:
- the new cache int stream
-
mapToObj
Description copied from interface:IntCacheStream- Specified by:
mapToObjin interfaceIntCacheStream- Specified by:
mapToObjin interfaceIntStream- Returns:
- the new cache stream
-
mapToLong
Description copied from interface:IntCacheStream- Specified by:
mapToLongin interfaceIntCacheStream- Specified by:
mapToLongin interfaceIntStream- Returns:
- the new cache long stream
-
mapToDouble
Description copied from interface:IntCacheStream- Specified by:
mapToDoublein interfaceIntCacheStream- Specified by:
mapToDoublein interfaceIntStream- Returns:
- the new cache double stream
-
flatMap
Description copied from interface:IntCacheStream- Specified by:
flatMapin interfaceIntCacheStream- Specified by:
flatMapin interfaceIntStream- Returns:
- the new cache int stream
-
parallel
Description copied from interface:IntCacheStream- Specified by:
parallelin interfaceBaseStream<Integer,IntStream> - Specified by:
parallelin interfaceIntCacheStream- Specified by:
parallelin interfaceIntStream- Returns:
- a parallel cache int stream
-
iterator
-
spliterator
- Specified by:
spliteratorin interfaceBaseStream<Integer,IntStream> - Specified by:
spliteratorin interfaceIntStream
-
sequential
Description copied from interface:IntCacheStream- Specified by:
sequentialin interfaceBaseStream<Integer,IntStream> - Specified by:
sequentialin interfaceIntCacheStream- Specified by:
sequentialin interfaceIntStream- Returns:
- a sequential cache int stream
-
unordered
Description copied from interface:IntCacheStream- Specified by:
unorderedin interfaceBaseStream<Integer,IntStream> - Specified by:
unorderedin interfaceIntCacheStream- Returns:
- an unordered cache int stream
-
forEach
-
forEach
Description copied from interface:IntCacheStreamSame asIntStream.forEach(IntConsumer)except that it takes anObjIntConsumerthat provides access to the underlyingCachethat is backing this stream.Note that the
CacheAwareinterface is not supported for injection using this method as the cache is provided in the consumer directly.- Specified by:
forEachin interfaceIntCacheStream- Type Parameters:
K- key type of the cacheV- value type of the cache- Parameters:
action- consumer to be ran for each element in the stream
-
forEachOrdered
- Specified by:
forEachOrderedin interfaceIntStream
-
toArray
public int[] toArray() -
reduce
-
reduce
-
collect
-
sum
public int sum() -
min
-
max
-
count
public long count() -
average
-
summaryStatistics
- Specified by:
summaryStatisticsin interfaceIntStream
-
anyMatch
-
allMatch
-
noneMatch
-
findFirst
-
findAny
-
boxed
Description copied from interface:IntCacheStream- Specified by:
boxedin interfaceIntCacheStream- Specified by:
boxedin interfaceIntStream- Returns:
- the new cache stream containing integers
-
asDoubleStream
Description copied from interface:IntCacheStream- Specified by:
asDoubleStreamin interfaceIntCacheStream- Specified by:
asDoubleStreamin interfaceIntStream- Returns:
- the cache double stream
-
asLongStream
Description copied from interface:IntCacheStream- Specified by:
asLongStreamin interfaceIntCacheStream- Specified by:
asLongStreamin interfaceIntStream- Returns:
- the cache long stream
-
onClose
Description copied from interface:IntCacheStream- Specified by:
onClosein interfaceBaseStream<Integer,IntStream> - Specified by:
onClosein interfaceIntCacheStream- Returns:
- a cache int stream with the handler applied
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBaseStream<Integer,IntStream>
-