public class LocalLongCacheStream extends AbstractLocalCacheStream<Long,LongStream,LongCacheStream> implements LongCacheStream
AbstractLocalCacheStream.StreamSupplier<T,S extends BaseStream<T,S>>
LongStream.Builder
BaseCacheStream.SegmentCompletionListener
intermediateOperations, keysToFilter, onCloseRunnables, parallel, registry, segmentsToFilter, streamSupplier
Constructor and Description |
---|
LocalLongCacheStream(AbstractLocalCacheStream.StreamSupplier<Long,LongStream> streamSupplier,
boolean parallel,
ComponentRegistry registry) |
Modifier and Type | Method and Description |
---|---|
boolean |
allMatch(LongPredicate predicate) |
boolean |
anyMatch(LongPredicate predicate) |
DoubleCacheStream |
asDoubleStream() |
OptionalDouble |
average() |
CacheStream<Long> |
boxed() |
<R> R |
collect(Supplier<R> supplier,
ObjLongConsumer<R> accumulator,
BiConsumer<R,R> combiner) |
long |
count() |
LocalLongCacheStream |
disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache.
|
LocalLongCacheStream |
distinct() |
LocalLongCacheStream |
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.
|
LocalLongCacheStream |
filter(LongPredicate predicate) |
LocalLongCacheStream |
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.
|
LocalLongCacheStream |
filterKeySegments(IntSet segments)
Filters which entries are returned by what segment they are present in.
|
LocalLongCacheStream |
filterKeySegments(Set<Integer> segments)
Filters which entries are returned by what segment they are present in.
|
OptionalLong |
findAny() |
OptionalLong |
findFirst() |
LocalLongCacheStream |
flatMap(LongFunction<? extends LongStream> mapper) |
void |
forEach(LongConsumer action) |
<K,V> void |
forEach(ObjLongConsumer<Cache<K,V>> action)
Same as
LongStream.forEach(LongConsumer) except that it takes an ObjLongConsumer that
provides access to the underlying Cache that is backing this stream. |
void |
forEachOrdered(LongConsumer action) |
PrimitiveIterator.OfLong |
iterator() |
LocalLongCacheStream |
limit(long maxSize) |
LocalLongCacheStream |
map(LongUnaryOperator mapper) |
LocalDoubleCacheStream |
mapToDouble(LongToDoubleFunction mapper) |
LocalIntCacheStream |
mapToInt(LongToIntFunction mapper) |
<U> LocalCacheStream<U> |
mapToObj(LongFunction<? extends U> mapper) |
OptionalLong |
max() |
OptionalLong |
min() |
boolean |
noneMatch(LongPredicate predicate) |
LocalLongCacheStream |
parallelDistribution()
This would enable sending requests to all other remote nodes when a terminal operator is performed.
|
LocalLongCacheStream |
peek(LongConsumer action) |
OptionalLong |
reduce(LongBinaryOperator op) |
long |
reduce(long identity,
LongBinaryOperator op) |
LocalLongCacheStream |
segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed
processing.
|
LocalLongCacheStream |
sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time.
|
LocalLongCacheStream |
skip(long n) |
LocalLongCacheStream |
sorted() |
Spliterator.OfLong |
spliterator() |
long |
sum() |
LongSummaryStatistics |
summaryStatistics() |
LocalLongCacheStream |
timeout(long timeout,
TimeUnit unit)
Sets a given time to wait for a remote operation to respond by.
|
long[] |
toArray() |
close, createStream, isParallel, onClose, parallel, sequential, unordered
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allMatch, anyMatch, collect, filter, flatMap, forEach, forEach, map, mapToDouble, mapToInt, mapToObj, noneMatch, onClose, parallel, peek, reduce, reduce, sequential, unordered
builder, concat, empty, generate, iterate, of, of, range, rangeClosed
close, isParallel
public LocalLongCacheStream(AbstractLocalCacheStream.StreamSupplier<Long,LongStream> streamSupplier, boolean parallel, ComponentRegistry registry)
public LocalLongCacheStream filter(LongPredicate predicate)
LongCacheStream
filter
in interface LongStream
filter
in interface LongCacheStream
public LocalLongCacheStream map(LongUnaryOperator mapper)
LongCacheStream
map
in interface LongStream
map
in interface LongCacheStream
public <U> LocalCacheStream<U> mapToObj(LongFunction<? extends U> mapper)
LongCacheStream
mapToObj
in interface LongStream
mapToObj
in interface LongCacheStream
public LocalIntCacheStream mapToInt(LongToIntFunction mapper)
LongCacheStream
mapToInt
in interface LongStream
mapToInt
in interface LongCacheStream
public LocalDoubleCacheStream mapToDouble(LongToDoubleFunction mapper)
LongCacheStream
mapToDouble
in interface LongStream
mapToDouble
in interface LongCacheStream
public LocalLongCacheStream flatMap(LongFunction<? extends LongStream> mapper)
LongCacheStream
flatMap
in interface LongStream
flatMap
in interface LongCacheStream
public LocalLongCacheStream distinct()
LongCacheStream
distinct
in interface LongStream
distinct
in interface LongCacheStream
public LocalLongCacheStream sorted()
LongCacheStream
sorted
in interface LongStream
sorted
in interface LongCacheStream
public LocalLongCacheStream peek(LongConsumer action)
LongCacheStream
peek
in interface LongStream
peek
in interface LongCacheStream
public LocalLongCacheStream limit(long maxSize)
LongCacheStream
limit
in interface LongStream
limit
in interface LongCacheStream
public LocalLongCacheStream skip(long n)
LongCacheStream
skip
in interface LongStream
skip
in interface LongCacheStream
public void forEach(LongConsumer action)
forEach
in interface LongStream
public <K,V> void forEach(ObjLongConsumer<Cache<K,V>> action)
LongCacheStream
LongStream.forEach(LongConsumer)
except that it takes an ObjLongConsumer
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 LongCacheStream
K
- key type of the cacheV
- value type of the cacheaction
- consumer to be ran for each element in the streampublic void forEachOrdered(LongConsumer action)
forEachOrdered
in interface LongStream
public long[] toArray()
toArray
in interface LongStream
public long reduce(long identity, LongBinaryOperator op)
reduce
in interface LongStream
public OptionalLong reduce(LongBinaryOperator op)
reduce
in interface LongStream
public <R> R collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R,R> combiner)
collect
in interface LongStream
public long sum()
sum
in interface LongStream
public OptionalLong min()
min
in interface LongStream
public OptionalLong max()
max
in interface LongStream
public long count()
count
in interface LongStream
public OptionalDouble average()
average
in interface LongStream
public LongSummaryStatistics summaryStatistics()
summaryStatistics
in interface LongStream
public boolean anyMatch(LongPredicate predicate)
anyMatch
in interface LongStream
public boolean allMatch(LongPredicate predicate)
allMatch
in interface LongStream
public boolean noneMatch(LongPredicate predicate)
noneMatch
in interface LongStream
public OptionalLong findFirst()
findFirst
in interface LongStream
public OptionalLong findAny()
findAny
in interface LongStream
public DoubleCacheStream asDoubleStream()
LongCacheStream
asDoubleStream
in interface LongStream
asDoubleStream
in interface LongCacheStream
public CacheStream<Long> boxed()
LongCacheStream
boxed
in interface LongStream
boxed
in interface LongCacheStream
public PrimitiveIterator.OfLong iterator()
iterator
in interface BaseStream<Long,LongStream>
iterator
in interface LongStream
public Spliterator.OfLong spliterator()
spliterator
in interface BaseStream<Long,LongStream>
spliterator
in interface LongStream
public LocalLongCacheStream sequentialDistribution()
LongCacheStream
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
sequentialDistribution
in interface BaseCacheStream<Long,LongStream>
sequentialDistribution
in interface LongCacheStream
public LocalLongCacheStream parallelDistribution()
BaseCacheStream
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
parallelDistribution
in interface BaseCacheStream<Long,LongStream>
parallelDistribution
in interface LongCacheStream
public LocalLongCacheStream filterKeySegments(Set<Integer> segments)
LongCacheStream
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<Long,LongStream>
filterKeySegments
in interface LongCacheStream
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.public LocalLongCacheStream 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<Long,LongStream>
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.public LocalLongCacheStream filterKeys(Set<?> keys)
LongCacheStream
CacheStream.filter(Predicate)
if the filter is holding references to the same
keys.filterKeys
in interface BaseCacheStream<Long,LongStream>
filterKeys
in interface LongCacheStream
keys
- The keys that this stream will only operate on.public LocalLongCacheStream distributedBatchSize(int batchSize)
LongCacheStream
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<Long,LongStream>
distributedBatchSize
in interface LongCacheStream
batchSize
- The size of each batch. This defaults to the state transfer chunk size.public LocalLongCacheStream segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
LongCacheStream
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<Long,LongStream>
segmentCompletionListener
in interface LongCacheStream
listener
- The listener that will be called back as segments are completed.public LocalLongCacheStream disableRehashAware()
LongCacheStream
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<Long,LongStream>
disableRehashAware
in interface LongCacheStream
public LocalLongCacheStream timeout(long timeout, TimeUnit unit)
LongCacheStream
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<Long,LongStream>
timeout
in interface LongCacheStream
timeout
- the maximum time to waitunit
- the time unit of the timeout argumentCopyright © 2021 JBoss by Red Hat. All rights reserved.