public class DefaultSegmentedDataContainer<K,V> extends AbstractInternalDataContainer<K,V>
This implementation doesn't support bounding or temporary entries (L1).
AbstractInternalDataContainer.EntryIterator
DataContainer.ComputeAction<K,V>
Modifier and Type | Field and Description |
---|---|
protected AtomicReferenceArray<PeekableTouchableMap<K,V>> |
maps |
protected Supplier<PeekableTouchableMap<K,V>> |
mapSupplier |
protected io.reactivex.rxjava3.functions.Predicate<InternalCacheEntry<K,V>> |
notExpiredPredicate |
protected boolean |
shouldStopSegments |
configuration, entryFactory, evictionManager, expirationManager, keyPartitioner, listeners, orderer, passivator, timeService
Constructor and Description |
---|
DefaultSegmentedDataContainer(Supplier<PeekableTouchableMap<K,V>> mapSupplier,
int numSegments) |
Modifier and Type | Method and Description |
---|---|
void |
addSegments(IntSet segments)
Sets what segments this data container should be using.
|
void |
clear()
Removes all entries in the container
|
void |
forEach(IntSet segments,
Consumer<? super InternalCacheEntry<K,V>> action)
Performs the given action for each element of the container that maps to the given set of segments
until all elements have been processed or the action throws an exception.
|
PeekableTouchableMap<K,V> |
getMapForSegment(int segment) |
int |
getSegmentForKey(Object key) |
Iterator<InternalCacheEntry<K,V>> |
iterator() |
Iterator<InternalCacheEntry<K,V>> |
iterator(IntSet segments)
Same as
DataContainer.iterator() except that only entries that map to the provided segments are
returned via the iterator. |
Iterator<InternalCacheEntry<K,V>> |
iteratorIncludingExpired()
Same as
DataContainer.iterator() except that is also returns expired entries. |
Iterator<InternalCacheEntry<K,V>> |
iteratorIncludingExpired(IntSet segments)
Same as
DataContainer.iteratorIncludingExpired() except that only entries that map to the provided
segments are returned via the iterator. |
org.reactivestreams.Publisher<InternalCacheEntry<K,V>> |
publisher(int segment) |
void |
removeSegments(IntSet segments)
Removes and un-associates the given segments.
|
int |
sizeIncludingExpired() |
int |
sizeIncludingExpired(IntSet segment)
Returns how many entries are present in the data container that map to the given segments including any entries
that may be expired
|
Spliterator<InternalCacheEntry<K,V>> |
spliterator() |
Spliterator<InternalCacheEntry<K,V>> |
spliterator(IntSet segments)
Same as
DataContainer.spliterator() except that only entries that map to the provided segments are
returned via this spliterator. |
Spliterator<InternalCacheEntry<K,V>> |
spliteratorIncludingExpired()
Same as
DataContainer.spliterator() except that is also returns expired entries. |
Spliterator<InternalCacheEntry<K,V>> |
spliteratorIncludingExpired(IntSet segments)
Same as
DataContainer.spliteratorIncludingExpired() except that only entries that map to the provided
segments are returned via this spliterator. |
void |
start() |
void |
stop() |
addRemovalListener, applyListener, clear, compute, compute, computeEntryRemoved, computeEntryWritten, containsKey, containsKey, evict, evict, expiredIterationPredicate, filterExpiredEntries, get, get, handleEviction, peek, peek, put, put, remove, remove, removeRemovalListener, touch
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cleanUp, size
capacity, evictionSize, resize, size
protected final AtomicReferenceArray<PeekableTouchableMap<K,V>> maps
protected final Supplier<PeekableTouchableMap<K,V>> mapSupplier
protected boolean shouldStopSegments
protected io.reactivex.rxjava3.functions.Predicate<InternalCacheEntry<K,V>> notExpiredPredicate
public DefaultSegmentedDataContainer(Supplier<PeekableTouchableMap<K,V>> mapSupplier, int numSegments)
public void start()
public void stop()
public int getSegmentForKey(Object key)
getSegmentForKey
in class AbstractInternalDataContainer<K,V>
public PeekableTouchableMap<K,V> getMapForSegment(int segment)
getMapForSegment
in class AbstractInternalDataContainer<K,V>
public org.reactivestreams.Publisher<InternalCacheEntry<K,V>> publisher(int segment)
public Iterator<InternalCacheEntry<K,V>> iterator(IntSet segments)
InternalDataContainer
DataContainer.iterator()
except that only entries that map to the provided segments are
returned via the iterator. The iterator will not return expired entries.segments
- segments of entries to usepublic Iterator<InternalCacheEntry<K,V>> iterator()
DataContainer
This iterator only returns entries that are not expired, however it will not remove them while doing so.
public Spliterator<InternalCacheEntry<K,V>> spliterator(IntSet segments)
InternalDataContainer
DataContainer.spliterator()
except that only entries that map to the provided segments are
returned via this spliterator. The spliterator will not return expired entries.segments
- segments of entries to returnpublic Spliterator<InternalCacheEntry<K,V>> spliterator()
DataContainer
This spliterator only returns entries that are not expired, however it will not remove them while doing so.
public Iterator<InternalCacheEntry<K,V>> iteratorIncludingExpired(IntSet segments)
InternalDataContainer
DataContainer.iteratorIncludingExpired()
except that only entries that map to the provided
segments are returned via the iterator. The iterator can return expired entries.segments
- segments of entries to usepublic Iterator<InternalCacheEntry<K,V>> iteratorIncludingExpired()
DataContainer
DataContainer.iterator()
except that is also returns expired entries.public Spliterator<InternalCacheEntry<K,V>> spliteratorIncludingExpired(IntSet segments)
InternalDataContainer
DataContainer.spliteratorIncludingExpired()
except that only entries that map to the provided
segments are returned via this spliterator. The spliterator will return expired entries as well.segments
- segments of entries to usepublic Spliterator<InternalCacheEntry<K,V>> spliteratorIncludingExpired()
DataContainer
DataContainer.spliterator()
except that is also returns expired entries.public int sizeIncludingExpired(IntSet segment)
InternalDataContainer
segment
- segments of entries to countpublic int sizeIncludingExpired()
public void clear()
DataContainer
public void forEach(IntSet segments, Consumer<? super InternalCacheEntry<K,V>> action)
InternalDataContainer
action
- The action to be performed for each elementpublic void addSegments(IntSet segments)
InternalDataContainer
segments
- segments to associate with this containerpublic void removeSegments(IntSet segments)
InternalDataContainer
InternalDataContainer.addRemovalListener(Consumer)
of entries that were removed due to no longer being associated with this
container. There is no guarantee if the consumer is invoked once or multiple times for a given group of segments
and could be in any order.
When this method is invoked an implementation is free to remove any entries that don't map to segments currently
associated with this container. Note that entries that were removed due to their segments never being associated
with this container do not notify listeners registered via InternalDataContainer.addRemovalListener(Consumer)
.
segments
- segments that should no longer be associated with this containerCopyright © 2021 JBoss by Red Hat. All rights reserved.