public interface BaseCacheStream<T,S extends BaseStream<T,S>> extends BaseStream<T,S>
Cache
. This interface
is useful to hold a reference to any of the types while still being able to invoke some methods.Modifier and Type | Interface and Description |
---|---|
static interface |
BaseCacheStream.SegmentCompletionListener
Functional interface that is used as a callback when segments are completed.
|
Modifier and Type | Method and Description |
---|---|
BaseCacheStream |
disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache.
|
BaseCacheStream |
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.
|
BaseCacheStream |
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.
|
BaseCacheStream |
filterKeySegments(IntSet segments)
Filters which entries are returned by what segment they are present in.
|
BaseCacheStream |
filterKeySegments(Set<Integer> segments)
Deprecated.
since 9.3 This is to be replaced by
filterKeySegments(IntSet) |
BaseCacheStream |
parallelDistribution()
This would enable sending requests to all other remote nodes when a terminal operator is performed.
|
BaseCacheStream |
segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed
processing.
|
BaseCacheStream |
sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time.
|
BaseCacheStream |
timeout(long timeout,
TimeUnit unit)
Sets a given time to wait for a remote operation to respond by.
|
close, isParallel, iterator, onClose, parallel, sequential, spliterator, unordered
BaseCacheStream sequentialDistribution()
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
BaseCacheStream parallelDistribution()
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
BaseCacheStream filterKeySegments(Set<Integer> segments)
filterKeySegments(IntSet)
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.segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.BaseCacheStream filterKeySegments(IntSet segments)
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.segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.BaseCacheStream filterKeys(Set<?> keys)
CacheStream.filter(Predicate)
if the filter is holding references to the same
keys.keys
- The keys that this stream will only operate on.BaseCacheStream distributedBatchSize(int batchSize)
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.
batchSize
- The size of each batch. This defaults to the state transfer chunk size.BaseCacheStream segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
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 disableRehashAware()
and has no
flat map based operations. If this is done no segments will be notified.
listener
- The listener that will be called back as segments are completed.BaseCacheStream disableRehashAware()
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.
BaseCacheStream timeout(long timeout, TimeUnit unit)
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
- the maximum time to waitunit
- the time unit of the timeout argumentCopyright © 2021 JBoss by Red Hat. All rights reserved.