Class DistributedDoubleCacheStream<Original>
- java.lang.Object
-
- org.infinispan.stream.impl.AbstractCacheStream<Original,Double,DoubleStream,DoubleCacheStream>
-
- org.infinispan.stream.impl.DistributedDoubleCacheStream<Original>
-
- Type Parameters:
Original
- original stream type
- All Implemented Interfaces:
AutoCloseable
,BaseStream<Double,DoubleStream>
,DoubleStream
,BaseCacheStream<Double,DoubleStream>
,DoubleCacheStream
public class DistributedDoubleCacheStream<Original> extends AbstractCacheStream<Original,Double,DoubleStream,DoubleCacheStream> implements DoubleCacheStream
Implementation ofDoubleStream
that utilizes a lazily evaluated distributed back end execution. Note this class is only able to be created usingCacheStream.mapToDouble(ToDoubleFunction)
or similar methods from theCacheStream
interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.infinispan.stream.impl.AbstractCacheStream
AbstractCacheStream.MapOpsExternalizer
-
Nested classes/interfaces inherited from interface org.infinispan.BaseCacheStream
BaseCacheStream.SegmentCompletionListener
-
Nested classes/interfaces inherited from interface java.util.stream.DoubleStream
DoubleStream.Builder
-
-
Field Summary
-
Fields inherited from class org.infinispan.stream.impl.AbstractCacheStream
closeRunnable, csm, distributedBatchSize, dm, executor, includeLoader, intermediateOperations, iteratorOperation, keyPartitioner, keysToFilter, localAddress, parallel, parallelDistribution, partition, registry, rehashAware, segmentCompletionListener, segmentsToFilter, stateTransferLock, supplier, timeout, timeoutUnit, toKeyFunction
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DistributedDoubleCacheStream(AbstractCacheStream other)
This constructor is to be used only when a user calls a map or flat map method changing to a DoubleStream from a CacheStream, Stream, IntStream, LongStream etc.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allMatch(DoublePredicate predicate)
boolean
allMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.allMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
boolean
anyMatch(DoublePredicate predicate)
boolean
anyMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.anyMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
OptionalDouble
average()
CacheStream<Double>
boxed()
protected <R> DistributedCacheStream<Original,R>
cacheStream()
<R> R
collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R,R> combiner)
<R> R
collect(SerializableSupplier<R> supplier, SerializableObjDoubleConsumer<R> accumulator, SerializableBiConsumer<R,R> combiner)
Same asDoubleStream.collect(Supplier, ObjDoubleConsumer, BiConsumer)
except that the arguments must also implementSerializable
long
count()
DoubleCacheStream
disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache.DoubleCacheStream
distinct()
DoubleCacheStream
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.DoubleCacheStream
filter(DoublePredicate predicate)
DoubleCacheStream
filter(SerializableDoublePredicate predicate)
Same asDoubleCacheStream.filter(DoublePredicate)
except that the DoublePredicate must also implementSerializable
DoubleCacheStream
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.DoubleCacheStream
filterKeySegments(Set<Integer> segments)
Filters which entries are returned by what segment they are present in.DoubleCacheStream
filterKeySegments(org.infinispan.commons.util.IntSet segments)
Filters which entries are returned by what segment they are present in.OptionalDouble
findAny()
OptionalDouble
findFirst()
DoubleCacheStream
flatMap(DoubleFunction<? extends DoubleStream> mapper)
DoubleCacheStream
flatMap(SerializableDoubleFunction<? extends DoubleStream> mapper)
Same asDoubleCacheStream.flatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
void
forEach(DoubleConsumer action)
<K,V>
voidforEach(ObjDoubleConsumer<Cache<K,V>> action)
Same asDoubleStream.forEach(DoubleConsumer)
except that it takes anObjDoubleConsumer
that provides access to the underlyingCache
that is backing this stream.void
forEach(SerializableDoubleConsumer action)
Same asDoubleStream.forEach(DoubleConsumer)
except that the DoubleConsumer must also implementSerializable
<K,V>
voidforEach(SerializableObjDoubleConsumer<Cache<K,V>> action)
Same asDoubleCacheStream.forEach(ObjDoubleConsumer)
except that theBiConsumer
must also implementSerializable
void
forEachOrdered(DoubleConsumer action)
protected Log
getLog()
protected DistributedIntCacheStream<Original>
intCacheStream()
PrimitiveIterator.OfDouble
iterator()
DoubleCacheStream
limit(long maxSize)
protected DistributedLongCacheStream<Original>
longCacheStream()
DoubleCacheStream
map(DoubleUnaryOperator mapper)
DoubleCacheStream
map(SerializableDoubleUnaryOperator mapper)
Same asDoubleCacheStream.map(DoubleUnaryOperator)
except that the DoubleUnaryOperator must also implementSerializable
IntCacheStream
mapToInt(DoubleToIntFunction mapper)
IntCacheStream
mapToInt(SerializableDoubleToIntFunction mapper)
Same asDoubleCacheStream.mapToInt(DoubleToIntFunction)
except that the DoubleToIntFunction must also implementSerializable
LongCacheStream
mapToLong(DoubleToLongFunction mapper)
LongCacheStream
mapToLong(SerializableDoubleToLongFunction mapper)
Same asDoubleCacheStream.mapToLong(DoubleToLongFunction)
except that the DoubleToLongFunction must also implementSerializable
<U> CacheStream<U>
mapToObj(DoubleFunction<? extends U> mapper)
<U> CacheStream<U>
mapToObj(SerializableDoubleFunction<? extends U> mapper)
Same asDoubleCacheStream.mapToObj(DoubleFunction)
except that the DoubleFunction must also implementSerializable
OptionalDouble
max()
OptionalDouble
min()
boolean
noneMatch(DoublePredicate predicate)
boolean
noneMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.noneMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
DoubleCacheStream
parallelDistribution()
This would enable sending requests to all other remote nodes when a terminal operator is performed.DoubleCacheStream
peek(DoubleConsumer action)
DoubleCacheStream
peek(SerializableDoubleConsumer action)
Same asDoubleCacheStream.flatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
double
reduce(double identity, DoubleBinaryOperator op)
double
reduce(double identity, SerializableDoubleBinaryOperator op)
Same asDoubleStream.reduce(double, DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
OptionalDouble
reduce(DoubleBinaryOperator op)
OptionalDouble
reduce(SerializableDoubleBinaryOperator op)
Same asDoubleStream.reduce(DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
DoubleCacheStream
segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed processing.DoubleCacheStream
sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time.DoubleCacheStream
skip(long n)
DoubleCacheStream
sorted()
Spliterator.OfDouble
spliterator()
double
sum()
DoubleSummaryStatistics
summaryStatistics()
DoubleCacheStream
timeout(long timeout, TimeUnit unit)
Sets a given time to wait for a remote operation to respond by.double[]
toArray()
protected DoubleCacheStream
unwrap()
-
Methods inherited from class org.infinispan.stream.impl.AbstractCacheStream
addIntermediateOperation, addIntermediateOperation, addIntermediateOperationMap, close, composeWithExceptions, isParallel, isPrimaryOwner, nonNullKeyFunction, onClose, parallel, sequential, supplierForSegments, supplierForSegments, unordered
-
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
close, isParallel
-
Methods inherited from interface org.infinispan.DoubleCacheStream
onClose, parallel, sequential, unordered
-
Methods inherited from interface java.util.stream.DoubleStream
dropWhile, takeWhile
-
-
-
-
Constructor Detail
-
DistributedDoubleCacheStream
protected DistributedDoubleCacheStream(AbstractCacheStream other)
This constructor is to be used only when a user calls a map or flat map method changing to a DoubleStream from a CacheStream, Stream, IntStream, LongStream etc.- Parameters:
other
- other instance ofAbstractCacheStream
to copy details from
-
-
Method Detail
-
getLog
protected Log getLog()
- Specified by:
getLog
in classAbstractCacheStream<Original,Double,DoubleStream,DoubleCacheStream>
-
unwrap
protected DoubleCacheStream unwrap()
- Specified by:
unwrap
in classAbstractCacheStream<Original,Double,DoubleStream,DoubleCacheStream>
-
filter
public DoubleCacheStream filter(DoublePredicate predicate)
Description copied from interface:DoubleCacheStream
- Specified by:
filter
in interfaceDoubleCacheStream
- Specified by:
filter
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
filter
public DoubleCacheStream filter(SerializableDoublePredicate predicate)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.filter(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
filter
in interfaceDoubleCacheStream
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to each element to determine if it should be included- Returns:
- the new cache double stream
-
map
public DoubleCacheStream map(DoubleUnaryOperator mapper)
Description copied from interface:DoubleCacheStream
- Specified by:
map
in interfaceDoubleCacheStream
- Specified by:
map
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
map
public DoubleCacheStream map(SerializableDoubleUnaryOperator mapper)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.map(DoubleUnaryOperator)
except that the DoubleUnaryOperator must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
map
in interfaceDoubleCacheStream
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache double stream
-
mapToObj
public <U> CacheStream<U> mapToObj(DoubleFunction<? extends U> mapper)
Description copied from interface:DoubleCacheStream
- Specified by:
mapToObj
in interfaceDoubleCacheStream
- Specified by:
mapToObj
in interfaceDoubleStream
- Returns:
- the new cache stream
-
mapToObj
public <U> CacheStream<U> mapToObj(SerializableDoubleFunction<? extends U> mapper)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.mapToObj(DoubleFunction)
except that the DoubleFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
mapToObj
in interfaceDoubleCacheStream
- Type Parameters:
U
- the element type of the new stream- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache stream
-
mapToInt
public IntCacheStream mapToInt(DoubleToIntFunction mapper)
Description copied from interface:DoubleCacheStream
- Specified by:
mapToInt
in interfaceDoubleCacheStream
- Specified by:
mapToInt
in interfaceDoubleStream
- Returns:
- the new cache int stream
-
mapToInt
public IntCacheStream mapToInt(SerializableDoubleToIntFunction mapper)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.mapToInt(DoubleToIntFunction)
except that the DoubleToIntFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
mapToInt
in interfaceDoubleCacheStream
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache int stream
-
mapToLong
public LongCacheStream mapToLong(DoubleToLongFunction mapper)
Description copied from interface:DoubleCacheStream
- Specified by:
mapToLong
in interfaceDoubleCacheStream
- Specified by:
mapToLong
in interfaceDoubleStream
- Returns:
- the new cache long stream
-
mapToLong
public LongCacheStream mapToLong(SerializableDoubleToLongFunction mapper)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.mapToLong(DoubleToLongFunction)
except that the DoubleToLongFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
mapToLong
in interfaceDoubleCacheStream
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache long stream
-
flatMap
public DoubleCacheStream flatMap(DoubleFunction<? extends DoubleStream> mapper)
Description copied from interface:DoubleCacheStream
- Specified by:
flatMap
in interfaceDoubleCacheStream
- Specified by:
flatMap
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
flatMap
public DoubleCacheStream flatMap(SerializableDoubleFunction<? extends DoubleStream> mapper)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.flatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
flatMap
in interfaceDoubleCacheStream
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element which produces aDoubleStream
of new values- Returns:
- the new cache double stream
-
distinct
public DoubleCacheStream distinct()
Description copied from interface:DoubleCacheStream
- Specified by:
distinct
in interfaceDoubleCacheStream
- Specified by:
distinct
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
sorted
public DoubleCacheStream sorted()
Description copied from interface:DoubleCacheStream
- Specified by:
sorted
in interfaceDoubleCacheStream
- Specified by:
sorted
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
peek
public DoubleCacheStream peek(DoubleConsumer action)
Description copied from interface:DoubleCacheStream
- Specified by:
peek
in interfaceDoubleCacheStream
- Specified by:
peek
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
peek
public DoubleCacheStream peek(SerializableDoubleConsumer action)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.flatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
peek
in interfaceDoubleCacheStream
- Parameters:
action
- a non-interfering action to perform on the elements as they are consumed from the stream- Returns:
- the new cache double stream
-
limit
public DoubleCacheStream limit(long maxSize)
Description copied from interface:DoubleCacheStream
- Specified by:
limit
in interfaceDoubleCacheStream
- Specified by:
limit
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
skip
public DoubleCacheStream skip(long n)
Description copied from interface:DoubleCacheStream
- Specified by:
skip
in interfaceDoubleCacheStream
- Specified by:
skip
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
boxed
public CacheStream<Double> boxed()
Description copied from interface:DoubleCacheStream
- Specified by:
boxed
in interfaceDoubleCacheStream
- Specified by:
boxed
in interfaceDoubleStream
- Returns:
- the new cache stream containing doubles
-
forEach
public void forEach(DoubleConsumer action)
- Specified by:
forEach
in interfaceDoubleStream
-
forEach
public void forEach(SerializableDoubleConsumer action)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.forEach(DoubleConsumer)
except that the DoubleConsumer must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
forEach
in interfaceDoubleCacheStream
- Parameters:
action
- a non-interfering action to perform on the elements
-
forEach
public <K,V> void forEach(ObjDoubleConsumer<Cache<K,V>> action)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.forEach(DoubleConsumer)
except that it takes anObjDoubleConsumer
that provides access to the underlyingCache
that is backing this stream.Note that the
CacheAware
interface is not supported for injection using this method as the cache is provided in the consumer directly.- Specified by:
forEach
in interfaceDoubleCacheStream
- 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
-
forEach
public <K,V> void forEach(SerializableObjDoubleConsumer<Cache<K,V>> action)
Description copied from interface:DoubleCacheStream
Same asDoubleCacheStream.forEach(ObjDoubleConsumer)
except that theBiConsumer
must also implementSerializable
- Specified by:
forEach
in interfaceDoubleCacheStream
- 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
public void forEachOrdered(DoubleConsumer action)
- Specified by:
forEachOrdered
in interfaceDoubleStream
-
toArray
public double[] toArray()
- Specified by:
toArray
in interfaceDoubleStream
-
reduce
public double reduce(double identity, DoubleBinaryOperator op)
- Specified by:
reduce
in interfaceDoubleStream
-
reduce
public double reduce(double identity, SerializableDoubleBinaryOperator op)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.reduce(double, DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
reduce
in interfaceDoubleCacheStream
- Parameters:
identity
- the identity value for the accumulating functionop
- an associative, non-interfering, stateless function for combining two values- Returns:
- the result of the reduction
-
reduce
public OptionalDouble reduce(DoubleBinaryOperator op)
- Specified by:
reduce
in interfaceDoubleStream
-
reduce
public OptionalDouble reduce(SerializableDoubleBinaryOperator op)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.reduce(DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
reduce
in interfaceDoubleCacheStream
- Parameters:
op
- an associative, non-interfering, stateless function for combining two values- Returns:
- the result of the reduction
-
collect
public <R> R collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R,R> combiner)
- Specified by:
collect
in interfaceDoubleStream
-
collect
public <R> R collect(SerializableSupplier<R> supplier, SerializableObjDoubleConsumer<R> accumulator, SerializableBiConsumer<R,R> combiner)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.collect(Supplier, ObjDoubleConsumer, BiConsumer)
except that the arguments must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
collect
in interfaceDoubleCacheStream
- Type Parameters:
R
- type of the result- Parameters:
supplier
- a function that creates a new result container. For a parallel execution, this function may be called multiple times and must return a fresh value each time.accumulator
- an associative, non-interfering, stateless function for incorporating an additional element into a resultcombiner
- an associative, non-interfering, stateless function for combining two values, which must be compatible with the accumulator function- Returns:
- the result of the reduction
-
sum
public double sum()
- Specified by:
sum
in interfaceDoubleStream
-
min
public OptionalDouble min()
- Specified by:
min
in interfaceDoubleStream
-
max
public OptionalDouble max()
- Specified by:
max
in interfaceDoubleStream
-
average
public OptionalDouble average()
- Specified by:
average
in interfaceDoubleStream
-
summaryStatistics
public DoubleSummaryStatistics summaryStatistics()
- Specified by:
summaryStatistics
in interfaceDoubleStream
-
anyMatch
public boolean anyMatch(DoublePredicate predicate)
- Specified by:
anyMatch
in interfaceDoubleStream
-
anyMatch
public boolean anyMatch(SerializableDoublePredicate predicate)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.anyMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
anyMatch
in interfaceDoubleCacheStream
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to elements of this stream- Returns:
true
if any elements of the stream match the provided predicate, otherwisefalse
-
allMatch
public boolean allMatch(DoublePredicate predicate)
- Specified by:
allMatch
in interfaceDoubleStream
-
allMatch
public boolean allMatch(SerializableDoublePredicate predicate)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.allMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
allMatch
in interfaceDoubleCacheStream
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to elements of this stream- Returns:
true
if either all elements of the stream match the provided predicate or the stream is empty, otherwisefalse
-
noneMatch
public boolean noneMatch(DoublePredicate predicate)
- Specified by:
noneMatch
in interfaceDoubleStream
-
noneMatch
public boolean noneMatch(SerializableDoublePredicate predicate)
Description copied from interface:DoubleCacheStream
Same asDoubleStream.noneMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Specified by:
noneMatch
in interfaceDoubleCacheStream
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to elements of this stream- Returns:
true
if either no elements of the stream match the provided predicate or the stream is empty, otherwisefalse
-
findFirst
public OptionalDouble findFirst()
- Specified by:
findFirst
in interfaceDoubleStream
-
findAny
public OptionalDouble findAny()
- Specified by:
findAny
in interfaceDoubleStream
-
iterator
public PrimitiveIterator.OfDouble iterator()
- Specified by:
iterator
in interfaceBaseStream<Double,DoubleStream>
- Specified by:
iterator
in interfaceDoubleStream
-
spliterator
public Spliterator.OfDouble spliterator()
- Specified by:
spliterator
in interfaceBaseStream<Double,DoubleStream>
- Specified by:
spliterator
in interfaceDoubleStream
-
count
public long count()
- Specified by:
count
in interfaceDoubleStream
-
sequentialDistribution
public DoubleCacheStream sequentialDistribution()
Description copied from interface:DoubleCacheStream
This 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:
sequentialDistribution
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
sequentialDistribution
in interfaceDoubleCacheStream
- Returns:
- a stream with parallel distribution disabled.
-
parallelDistribution
public DoubleCacheStream parallelDistribution()
Description copied from interface:BaseCacheStream
This 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:
parallelDistribution
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
parallelDistribution
in interfaceDoubleCacheStream
- Returns:
- a stream with parallel distribution enabled.
-
filterKeySegments
public DoubleCacheStream filterKeySegments(Set<Integer> segments)
Description copied from interface:DoubleCacheStream
Filters 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:
filterKeySegments
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
filterKeySegments
in interfaceDoubleCacheStream
- 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
public DoubleCacheStream filterKeySegments(org.infinispan.commons.util.IntSet segments)
Description copied from interface:BaseCacheStream
Filters 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:
filterKeySegments
in interfaceBaseCacheStream<Double,DoubleStream>
- 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
public DoubleCacheStream filterKeys(Set<?> keys)
Description copied from interface:DoubleCacheStream
Filters 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:
filterKeys
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
filterKeys
in interfaceDoubleCacheStream
- Parameters:
keys
- The keys that this stream will only operate on.- Returns:
- a stream with the keys filtered.
-
distributedBatchSize
public DoubleCacheStream distributedBatchSize(int batchSize)
Description copied from interface:DoubleCacheStream
Controls 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:
distributedBatchSize
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
distributedBatchSize
in interfaceDoubleCacheStream
- Parameters:
batchSize
- The size of each batch. This defaults to the state transfer chunk size.- Returns:
- a stream with the batch size updated
-
segmentCompletionListener
public DoubleCacheStream segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Description copied from interface:DoubleCacheStream
Allows 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:
segmentCompletionListener
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
segmentCompletionListener
in interfaceDoubleCacheStream
- Parameters:
listener
- The listener that will be called back as segments are completed.- Returns:
- a stream with the listener registered.
-
disableRehashAware
public DoubleCacheStream disableRehashAware()
Description copied from interface:DoubleCacheStream
Disables 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:
disableRehashAware
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
disableRehashAware
in interfaceDoubleCacheStream
- Returns:
- a stream with rehash awareness disabled.
-
timeout
public DoubleCacheStream timeout(long timeout, TimeUnit unit)
Description copied from interface:DoubleCacheStream
Sets 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
TimeoutException
is thrown from the terminal operation invoking thread or on the next call to theIterator
orSpliterator
.Note that if a rehash occurs this timeout value is reset for the subsequent retry if rehash aware is enabled.
- Specified by:
timeout
in interfaceBaseCacheStream<Double,DoubleStream>
- Specified by:
timeout
in interfaceDoubleCacheStream
- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument- Returns:
- a stream with the timeout set
-
cacheStream
protected <R> DistributedCacheStream<Original,R> cacheStream()
-
intCacheStream
protected DistributedIntCacheStream<Original> intCacheStream()
-
longCacheStream
protected DistributedLongCacheStream<Original> longCacheStream()
-
-