Original
- original stream typepublic class DistributedDoubleCacheStream<Original> extends AbstractCacheStream<Original,Double,DoubleStream,DoubleCacheStream> implements DoubleCacheStream
DoubleStream
that utilizes a lazily evaluated distributed back end execution. Note this
class is only able to be created using CacheStream.mapToDouble(ToDoubleFunction)
or similar
methods from the CacheStream
interface.DoubleStream.Builder
BaseCacheStream.SegmentCompletionListener
closeRunnable, cpm, distributedBatchSize, dm, executor, includeLoader, intermediateOperations, invocationContext, iteratorOperation, keyPartitioner, keysToFilter, localAddress, parallel, parallelDistribution, partition, registry, rehashAware, segmentCompletionListener, segmentsToFilter, stateTransferLock, supplier, timeout, timeoutUnit, toKeyFunction
Modifier | Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allMatch(DoublePredicate predicate) |
boolean |
anyMatch(DoublePredicate predicate) |
OptionalDouble |
average() |
CacheStream<Double> |
boxed() |
protected <R> DistributedCacheStream<Original,R> |
cacheStream() |
<R> R |
collect(Supplier<R> supplier,
ObjDoubleConsumer<R> accumulator,
BiConsumer<R,R> combiner) |
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 as
DoubleCacheStream.filter(DoublePredicate) except that the DoublePredicate must also
implement Serializable |
DoubleCacheStream |
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.
|
DoubleCacheStream |
filterKeySegments(IntSet segments)
Filters which entries are returned by what segment they are present in.
|
DoubleCacheStream |
filterKeySegments(Set<Integer> 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 as
DoubleCacheStream.flatMap(DoubleFunction) except that the DoubleFunction must also
implement Serializable |
void |
forEach(DoubleConsumer action) |
<K,V> void |
forEach(ObjDoubleConsumer<Cache<K,V>> action)
Same as
DoubleStream.forEach(DoubleConsumer) except that it takes an ObjDoubleConsumer that
provides access to the underlying Cache that is backing this stream. |
void |
forEach(SerializableDoubleConsumer action)
Same as
DoubleStream.forEach(DoubleConsumer) except that the DoubleConsumer must also
implement Serializable |
<K,V> void |
forEach(SerializableObjDoubleConsumer<Cache<K,V>> action)
Same as
DoubleCacheStream.forEach(ObjDoubleConsumer) except that the BiConsumer must also implement
Serializable |
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 as
DoubleCacheStream.map(DoubleUnaryOperator) except that the DoubleUnaryOperator must also
implement Serializable |
IntCacheStream |
mapToInt(DoubleToIntFunction mapper) |
IntCacheStream |
mapToInt(SerializableDoubleToIntFunction mapper)
Same as
DoubleCacheStream.mapToInt(DoubleToIntFunction) except that the DoubleToIntFunction must also
implement Serializable |
LongCacheStream |
mapToLong(DoubleToLongFunction mapper) |
LongCacheStream |
mapToLong(SerializableDoubleToLongFunction mapper)
Same as
DoubleCacheStream.mapToLong(DoubleToLongFunction) except that the DoubleToLongFunction must also
implement Serializable |
<U> CacheStream<U> |
mapToObj(DoubleFunction<? extends U> mapper) |
<U> CacheStream<U> |
mapToObj(SerializableDoubleFunction<? extends U> mapper)
Same as
DoubleCacheStream.mapToObj(DoubleFunction) except that the DoubleFunction must also
implement Serializable |
OptionalDouble |
max() |
OptionalDouble |
min() |
boolean |
noneMatch(DoublePredicate predicate) |
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 as
DoubleCacheStream.flatMap(DoubleFunction) except that the DoubleFunction must also
implement Serializable |
OptionalDouble |
reduce(DoubleBinaryOperator op) |
double |
reduce(double identity,
DoubleBinaryOperator op) |
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() |
addIntermediateOperation, addIntermediateOperation, addIntermediateOperationMap, close, composeWithExceptions, isParallel, isPrimaryOwner, onClose, parallel, sequential, unordered
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allMatch, anyMatch, collect, noneMatch, onClose, parallel, reduce, reduce, sequential, unordered
builder, concat, empty, generate, iterate, of, of
close, isParallel
protected DistributedDoubleCacheStream(AbstractCacheStream other)
other
- other instance of AbstractCacheStream
to copy details fromprotected Log getLog()
getLog
in class AbstractCacheStream<Original,Double,DoubleStream,DoubleCacheStream>
protected DoubleCacheStream unwrap()
unwrap
in class AbstractCacheStream<Original,Double,DoubleStream,DoubleCacheStream>
public DoubleCacheStream filter(DoublePredicate predicate)
DoubleCacheStream
filter
in interface DoubleStream
filter
in interface DoubleCacheStream
public DoubleCacheStream filter(SerializableDoublePredicate predicate)
DoubleCacheStream
DoubleCacheStream.filter(DoublePredicate)
except that the DoublePredicate must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
filter
in interface DoubleCacheStream
predicate
- a non-interfering, stateless
predicate to apply to each element to determine if it
should be includedpublic DoubleCacheStream map(DoubleUnaryOperator mapper)
DoubleCacheStream
map
in interface DoubleStream
map
in interface DoubleCacheStream
public DoubleCacheStream map(SerializableDoubleUnaryOperator mapper)
DoubleCacheStream
DoubleCacheStream.map(DoubleUnaryOperator)
except that the DoubleUnaryOperator must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
map
in interface DoubleCacheStream
mapper
- a non-interfering, stateless
function to apply to each elementpublic <U> CacheStream<U> mapToObj(DoubleFunction<? extends U> mapper)
DoubleCacheStream
mapToObj
in interface DoubleStream
mapToObj
in interface DoubleCacheStream
public <U> CacheStream<U> mapToObj(SerializableDoubleFunction<? extends U> mapper)
DoubleCacheStream
DoubleCacheStream.mapToObj(DoubleFunction)
except that the DoubleFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapToObj
in interface DoubleCacheStream
U
- the element type of the new streammapper
- a non-interfering, stateless
function to apply to each elementpublic IntCacheStream mapToInt(DoubleToIntFunction mapper)
DoubleCacheStream
mapToInt
in interface DoubleStream
mapToInt
in interface DoubleCacheStream
public IntCacheStream mapToInt(SerializableDoubleToIntFunction mapper)
DoubleCacheStream
DoubleCacheStream.mapToInt(DoubleToIntFunction)
except that the DoubleToIntFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapToInt
in interface DoubleCacheStream
mapper
- a non-interfering, stateless
function to apply to each elementpublic LongCacheStream mapToLong(DoubleToLongFunction mapper)
DoubleCacheStream
mapToLong
in interface DoubleStream
mapToLong
in interface DoubleCacheStream
public LongCacheStream mapToLong(SerializableDoubleToLongFunction mapper)
DoubleCacheStream
DoubleCacheStream.mapToLong(DoubleToLongFunction)
except that the DoubleToLongFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapToLong
in interface DoubleCacheStream
mapper
- a non-interfering, stateless
function to apply to each elementpublic DoubleCacheStream flatMap(DoubleFunction<? extends DoubleStream> mapper)
DoubleCacheStream
flatMap
in interface DoubleStream
flatMap
in interface DoubleCacheStream
public DoubleCacheStream flatMap(SerializableDoubleFunction<? extends DoubleStream> mapper)
DoubleCacheStream
DoubleCacheStream.flatMap(DoubleFunction)
except that the DoubleFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
flatMap
in interface DoubleCacheStream
mapper
- a non-interfering, stateless
function to apply to each element which produces a
DoubleStream
of new valuespublic DoubleCacheStream distinct()
DoubleCacheStream
distinct
in interface DoubleStream
distinct
in interface DoubleCacheStream
public DoubleCacheStream sorted()
DoubleCacheStream
sorted
in interface DoubleStream
sorted
in interface DoubleCacheStream
public DoubleCacheStream peek(DoubleConsumer action)
DoubleCacheStream
peek
in interface DoubleStream
peek
in interface DoubleCacheStream
public DoubleCacheStream peek(SerializableDoubleConsumer action)
DoubleCacheStream
DoubleCacheStream.flatMap(DoubleFunction)
except that the DoubleFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
peek
in interface DoubleCacheStream
action
- a non-interfering action to perform on the elements as
they are consumed from the streampublic DoubleCacheStream limit(long maxSize)
DoubleCacheStream
limit
in interface DoubleStream
limit
in interface DoubleCacheStream
public DoubleCacheStream skip(long n)
DoubleCacheStream
skip
in interface DoubleStream
skip
in interface DoubleCacheStream
public CacheStream<Double> boxed()
DoubleCacheStream
boxed
in interface DoubleStream
boxed
in interface DoubleCacheStream
public void forEach(DoubleConsumer action)
forEach
in interface DoubleStream
public void forEach(SerializableDoubleConsumer action)
DoubleCacheStream
DoubleStream.forEach(DoubleConsumer)
except that the DoubleConsumer must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
forEach
in interface DoubleCacheStream
action
- a non-interfering action to perform on the elementspublic <K,V> void forEach(ObjDoubleConsumer<Cache<K,V>> action)
DoubleCacheStream
DoubleStream.forEach(DoubleConsumer)
except that it takes an ObjDoubleConsumer
that
provides access to the underlying Cache
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.
forEach
in interface DoubleCacheStream
K
- key type of the cacheV
- value type of the cacheaction
- consumer to be ran for each element in the streampublic <K,V> void forEach(SerializableObjDoubleConsumer<Cache<K,V>> action)
DoubleCacheStream
DoubleCacheStream.forEach(ObjDoubleConsumer)
except that the BiConsumer
must also implement
Serializable
forEach
in interface DoubleCacheStream
K
- key type of the cacheV
- value type of the cacheaction
- consumer to be ran for each element in the streampublic void forEachOrdered(DoubleConsumer action)
forEachOrdered
in interface DoubleStream
public double[] toArray()
toArray
in interface DoubleStream
public double reduce(double identity, DoubleBinaryOperator op)
reduce
in interface DoubleStream
public OptionalDouble reduce(DoubleBinaryOperator op)
reduce
in interface DoubleStream
public <R> R collect(Supplier<R> supplier, ObjDoubleConsumer<R> accumulator, BiConsumer<R,R> combiner)
collect
in interface DoubleStream
public double sum()
sum
in interface DoubleStream
public OptionalDouble min()
min
in interface DoubleStream
public OptionalDouble max()
max
in interface DoubleStream
public OptionalDouble average()
average
in interface DoubleStream
public DoubleSummaryStatistics summaryStatistics()
summaryStatistics
in interface DoubleStream
public boolean anyMatch(DoublePredicate predicate)
anyMatch
in interface DoubleStream
public boolean allMatch(DoublePredicate predicate)
allMatch
in interface DoubleStream
public boolean noneMatch(DoublePredicate predicate)
noneMatch
in interface DoubleStream
public OptionalDouble findFirst()
findFirst
in interface DoubleStream
public OptionalDouble findAny()
findAny
in interface DoubleStream
public PrimitiveIterator.OfDouble iterator()
iterator
in interface BaseStream<Double,DoubleStream>
iterator
in interface DoubleStream
public Spliterator.OfDouble spliterator()
spliterator
in interface BaseStream<Double,DoubleStream>
spliterator
in interface DoubleStream
public long count()
count
in interface DoubleStream
public DoubleCacheStream sequentialDistribution()
DoubleCacheStream
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
sequentialDistribution
in interface BaseCacheStream<Double,DoubleStream>
sequentialDistribution
in interface DoubleCacheStream
public DoubleCacheStream parallelDistribution()
BaseCacheStream
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
parallelDistribution
in interface BaseCacheStream<Double,DoubleStream>
parallelDistribution
in interface DoubleCacheStream
public DoubleCacheStream filterKeySegments(Set<Integer> segments)
DoubleCacheStream
CacheStream.filter(Predicate)
method as this can control what nodes are
asked for data and what entries are read from the underlying CacheStore if present.filterKeySegments
in interface BaseCacheStream<Double,DoubleStream>
filterKeySegments
in interface DoubleCacheStream
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.public DoubleCacheStream filterKeySegments(IntSet segments)
BaseCacheStream
CacheStream.filter(Predicate)
method as this can control what nodes are
asked for data and what entries are read from the underlying CacheStore if present.filterKeySegments
in interface BaseCacheStream<Double,DoubleStream>
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.public DoubleCacheStream filterKeys(Set<?> keys)
DoubleCacheStream
CacheStream.filter(Predicate)
if the filter is holding references to the same
keys.filterKeys
in interface BaseCacheStream<Double,DoubleStream>
filterKeys
in interface DoubleCacheStream
keys
- The keys that this stream will only operate on.public DoubleCacheStream distributedBatchSize(int batchSize)
DoubleCacheStream
CacheStream.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.
distributedBatchSize
in interface BaseCacheStream<Double,DoubleStream>
distributedBatchSize
in interface DoubleCacheStream
batchSize
- The size of each batch. This defaults to the state transfer chunk size.public DoubleCacheStream segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
DoubleCacheStream
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 see CacheStream.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.
segmentCompletionListener
in interface BaseCacheStream<Double,DoubleStream>
segmentCompletionListener
in interface DoubleCacheStream
listener
- The listener that will be called back as segments are completed.public DoubleCacheStream disableRehashAware()
DoubleCacheStream
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.
disableRehashAware
in interface BaseCacheStream<Double,DoubleStream>
disableRehashAware
in interface DoubleCacheStream
public DoubleCacheStream timeout(long timeout, TimeUnit unit)
DoubleCacheStream
If a timeout does occur then a TimeoutException
is thrown from the terminal
operation invoking thread or on the next call to the Iterator
or Spliterator
.
Note that if a rehash occurs this timeout value is reset for the subsequent retry if rehash aware is enabled.
timeout
in interface BaseCacheStream<Double,DoubleStream>
timeout
in interface DoubleCacheStream
timeout
- the maximum time to waitunit
- the time unit of the timeout argumentprotected <R> DistributedCacheStream<Original,R> cacheStream()
protected DistributedIntCacheStream<Original> intCacheStream()
protected DistributedLongCacheStream<Original> longCacheStream()
Copyright © 2021 JBoss by Red Hat. All rights reserved.