public class BoundedOffHeapDataContainer extends SegmentedBoundedOffHeapDataContainer
DataContainer.ComputeAction<K,V>| Modifier and Type | Field and Description |
|---|---|
protected List<Consumer<Iterable<InternalCacheEntry<WrappedBytes,WrappedBytes>>>> |
listeners |
allocator, currentSize, dataContainer, evictionManager, firstAddress, lastAddress, lruLock, maxSize, numSegments, offHeapEntryFactory, orderer, passivator, useCount| Constructor and Description |
|---|
BoundedOffHeapDataContainer(long maxSize,
EvictionType type) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRemovalListener(Consumer<Iterable<InternalCacheEntry<WrappedBytes,WrappedBytes>>> listener)
Adds a listener that is invoked whenever
InternalDataContainer.removeSegments(IntSet) is invoked providing a way for
the listener to see what actual entries were removed from the container. |
void |
addSegments(IntSet segments)
Sets what segments this data container should be using.
|
InternalCacheEntry<WrappedBytes,WrappedBytes> |
compute(int segment,
WrappedBytes key,
DataContainer.ComputeAction<WrappedBytes,WrappedBytes> action)
Same as
DataContainer.compute(Object, ComputeAction) except that the segment of the key can provided to
update entries without calculating the segment for the given key. |
InternalCacheEntry<WrappedBytes,WrappedBytes> |
compute(WrappedBytes key,
DataContainer.ComputeAction<WrappedBytes,WrappedBytes> action)
Computes the new value for the key.
|
boolean |
containsKey(int segment,
Object k)
Same as
DataContainer.containsKey(Object) except that the segment of the key can provided to
lookup if the entry exists without calculating the segment for the given key. |
boolean |
containsKey(Object k)
Tests whether an entry exists in the container
|
CompletionStage<Void> |
evict(int segment,
WrappedBytes key)
Same as
DataContainer.evict(Object) except that the segment of the key can provided to
remove the entry without calculating the segment for the given key. |
void |
evict(WrappedBytes key)
Atomically, it removes the key from
DataContainer and passivates it to persistence. |
InternalCacheEntry<WrappedBytes,WrappedBytes> |
get(int segment,
Object k)
Same as
DataContainer.get(Object) except that the segment of the key can provided to lookup entries
without calculating the segment for the given key |
InternalCacheEntry<WrappedBytes,WrappedBytes> |
get(Object k)
Retrieves a cached entry
|
protected OffHeapConcurrentMap |
getMapThatContainsKey(byte[] key) |
Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> |
iterator(IntSet segments)
Same as
DataContainer.iterator() except that only entries that map to the provided segments are
returned via the iterator. |
Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> |
iteratorIncludingExpired(IntSet segments)
Same as
DataContainer.iteratorIncludingExpired() except that only entries that map to the provided
segments are returned via the iterator. |
InternalCacheEntry<WrappedBytes,WrappedBytes> |
peek(int segment,
Object k)
Same as
DataContainer.peek(Object) except that the segment of the key can provided to lookup entries
without calculating the segment for the given key |
InternalCacheEntry<WrappedBytes,WrappedBytes> |
peek(Object k)
Retrieves a cache entry in the same way as
DataContainer.get(Object)} except that it does not update or reorder any of
the internal constructs. |
void |
put(int segment,
WrappedBytes key,
WrappedBytes value,
Metadata metadata,
PrivateMetadata internalMetadata,
long createdTimestamp,
long lastUseTimestamp)
Same as
DataContainer.put(Object, Object, Metadata) except that the segment of the key can provided to
write/lookup entries without calculating the segment for the given key. |
void |
put(WrappedBytes key,
WrappedBytes value,
Metadata metadata)
Puts an entry in the cache along with metadata adding information such lifespan of entry, max idle time, version
information...etc.
|
InternalCacheEntry<WrappedBytes,WrappedBytes> |
remove(int segment,
Object k)
Same as
DataContainer.remove(Object) except that the segment of the key can provided to
remove the entry without calculating the segment for the given key. |
InternalCacheEntry<WrappedBytes,WrappedBytes> |
remove(Object k)
Removes an entry from the cache
The
key must be activate by invoking ActivationManager.activateAsync(Object, int) |
void |
removeRemovalListener(Object listener)
Removes a previously registered listener via
InternalDataContainer.addRemovalListener(Consumer). |
void |
removeSegments(IntSet segments)
Removes and un-associates the given segments.
|
int |
size(IntSet segments)
Returns how many entries are present in the data container that map to the given segments without counting entries
that are currently expired.
|
int |
sizeIncludingExpired(IntSet segments)
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<WrappedBytes,WrappedBytes>> |
spliterator(IntSet segments)
Same as
DataContainer.spliterator() except that only entries that map to the provided segments are
returned via this spliterator. |
Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> |
spliteratorIncludingExpired(IntSet segments)
Same as
DataContainer.spliteratorIncludingExpired() except that only entries that map to the provided
segments are returned via this spliterator. |
capacity, delegate, evictionSize, getSize, start, stopclear, clear, forEach, forEach, iterator, iteratorIncludingExpired, resize, size, sizeIncludingExpired, spliterator, spliteratorIncludingExpired, touchclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcleanUp, publisherprotected final List<Consumer<Iterable<InternalCacheEntry<WrappedBytes,WrappedBytes>>>> listeners
public BoundedOffHeapDataContainer(long maxSize,
EvictionType type)
protected OffHeapConcurrentMap getMapThatContainsKey(byte[] key)
getMapThatContainsKey in class SegmentedBoundedOffHeapDataContainerpublic boolean containsKey(Object k)
DataContainercontainsKey in interface DataContainer<WrappedBytes,WrappedBytes>containsKey in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>k - key to testpublic InternalCacheEntry<WrappedBytes,WrappedBytes> peek(Object k)
DataContainerDataContainer.get(Object)} except that it does not update or reorder any of
the internal constructs. I.e., expiration does not happen, and in the case of the LRU container, the entry is not
moved to the end of the chain.
This method should be used instead of DataContainer.get(Object)} when called while iterating through the data container
using methods like DataContainer.iterator() to avoid changing the underlying collection's order.peek in interface DataContainer<WrappedBytes,WrappedBytes>peek in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>k - key under which entry is storedpublic InternalCacheEntry<WrappedBytes,WrappedBytes> get(Object k)
InternalDataContainer
We should only ever be using the non blocking variant InternalDataContainer.peek(int, Object) in Infinispan
get in interface DataContainer<WrappedBytes,WrappedBytes>get in interface InternalDataContainer<WrappedBytes,WrappedBytes>get in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>k - key under which entry is storedpublic InternalCacheEntry<WrappedBytes,WrappedBytes> compute(WrappedBytes key, DataContainer.ComputeAction<WrappedBytes,WrappedBytes> action)
DataContainerDataContainer.ComputeAction.compute(Object,
org.infinispan.container.entries.InternalCacheEntry, InternalEntryFactory).
The key must be activated by invoking ActivationManager.activateAsync(Object, int).
Note the entry provided to DataContainer.ComputeAction may be expired as these
entries are not filtered as many other methods do.
compute in interface DataContainer<WrappedBytes,WrappedBytes>compute in class SegmentedBoundedOffHeapDataContainerkey - The key.action - The action that will compute the new value.InternalCacheEntry associated to the key.public InternalCacheEntry<WrappedBytes,WrappedBytes> remove(Object k)
DataContainerkey must be activate by invoking ActivationManager.activateAsync(Object, int)remove in interface DataContainer<WrappedBytes,WrappedBytes>remove in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>k - key to removepublic void evict(WrappedBytes key)
DataContainerDataContainer and passivates it to persistence.
The passivation must be done by invoking the method PassivationManager.passivateAsync(InternalCacheEntry).evict in interface DataContainer<WrappedBytes,WrappedBytes>evict in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>key - The key to evict.public void put(WrappedBytes key, WrappedBytes value, Metadata metadata)
DataContainerkey must be activate by invoking ActivationManager.activateAsync(Object, int)
boolean)}.put in interface DataContainer<WrappedBytes,WrappedBytes>put in class SegmentedBoundedOffHeapDataContainerkey - key under which to store entryvalue - value to storemetadata - metadata of the entrypublic boolean containsKey(int segment,
Object k)
InternalDataContainerDataContainer.containsKey(Object) except that the segment of the key can provided to
lookup if the entry exists without calculating the segment for the given key.containsKey in interface InternalDataContainer<WrappedBytes,WrappedBytes>containsKey in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segment - segment for the keyk - key under which entry is storedpublic InternalCacheEntry<WrappedBytes,WrappedBytes> peek(int segment, Object k)
InternalDataContainerDataContainer.peek(Object) except that the segment of the key can provided to lookup entries
without calculating the segment for the given keypeek in interface InternalDataContainer<WrappedBytes,WrappedBytes>peek in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segment - segment for the keyk - key under which entry is storedpublic InternalCacheEntry<WrappedBytes,WrappedBytes> get(int segment, Object k)
InternalDataContainerDataContainer.get(Object) except that the segment of the key can provided to lookup entries
without calculating the segment for the given keyget in interface InternalDataContainer<WrappedBytes,WrappedBytes>get in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segment - segment for the keyk - key under which entry is storedpublic InternalCacheEntry<WrappedBytes,WrappedBytes> compute(int segment, WrappedBytes key, DataContainer.ComputeAction<WrappedBytes,WrappedBytes> action)
InternalDataContainerDataContainer.compute(Object, ComputeAction) except that the segment of the key can provided to
update entries without calculating the segment for the given key.compute in interface InternalDataContainer<WrappedBytes,WrappedBytes>compute in class SegmentedBoundedOffHeapDataContainersegment - segment for the keykey - The key.action - The action that will compute the new value.InternalCacheEntry associated to the key.public InternalCacheEntry<WrappedBytes,WrappedBytes> remove(int segment, Object k)
InternalDataContainerDataContainer.remove(Object) except that the segment of the key can provided to
remove the entry without calculating the segment for the given key.remove in interface InternalDataContainer<WrappedBytes,WrappedBytes>remove in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segment - segment for the keyk - key to removepublic CompletionStage<Void> evict(int segment, WrappedBytes key)
InternalDataContainerDataContainer.evict(Object) except that the segment of the key can provided to
remove the entry without calculating the segment for the given key.evict in interface InternalDataContainer<WrappedBytes,WrappedBytes>evict in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segment - segment for the keykey - The key to evict.public void put(int segment,
WrappedBytes key,
WrappedBytes value,
Metadata metadata,
PrivateMetadata internalMetadata,
long createdTimestamp,
long lastUseTimestamp)
InternalDataContainerDataContainer.put(Object, Object, Metadata) except that the segment of the key can provided to
write/lookup entries without calculating the segment for the given key.
Note: The timestamps ignored if the entry already exists in the data container.
put in interface InternalDataContainer<WrappedBytes,WrappedBytes>put in class SegmentedBoundedOffHeapDataContainersegment - segment for the keykey - key under which to store entryvalue - value to storemetadata - metadata of the entrycreatedTimestamp - creation timestamp, or -1 to use the current timelastUseTimestamp - last use timestamp, or -1 to use the current timepublic Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> spliterator(IntSet segments)
InternalDataContainerDataContainer.spliterator() except that only entries that map to the provided segments are
returned via this spliterator. The spliterator will not return expired entries.spliterator in interface InternalDataContainer<WrappedBytes,WrappedBytes>spliterator in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments of entries to returnpublic Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> spliteratorIncludingExpired(IntSet segments)
InternalDataContainerDataContainer.spliteratorIncludingExpired() except that only entries that map to the provided
segments are returned via this spliterator. The spliterator will return expired entries as well.spliteratorIncludingExpired in interface InternalDataContainer<WrappedBytes,WrappedBytes>spliteratorIncludingExpired in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments of entries to usepublic Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> iterator(IntSet segments)
InternalDataContainerDataContainer.iterator() except that only entries that map to the provided segments are
returned via the iterator. The iterator will not return expired entries.iterator in interface InternalDataContainer<WrappedBytes,WrappedBytes>iterator in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments of entries to usepublic Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> iteratorIncludingExpired(IntSet segments)
InternalDataContainerDataContainer.iteratorIncludingExpired() except that only entries that map to the provided
segments are returned via the iterator. The iterator can return expired entries.iteratorIncludingExpired in interface InternalDataContainer<WrappedBytes,WrappedBytes>iteratorIncludingExpired in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments of entries to usepublic int sizeIncludingExpired(IntSet segments)
InternalDataContainersizeIncludingExpired in interface InternalDataContainer<WrappedBytes,WrappedBytes>sizeIncludingExpired in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments of entries to countpublic int size(IntSet segments)
InternalDataContainersize in interface InternalDataContainer<WrappedBytes,WrappedBytes>size in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments of entries to countpublic void addRemovalListener(Consumer<Iterable<InternalCacheEntry<WrappedBytes,WrappedBytes>>> listener)
InternalDataContainerInternalDataContainer.removeSegments(IntSet) is invoked providing a way for
the listener to see what actual entries were removed from the container.addRemovalListener in interface InternalDataContainer<WrappedBytes,WrappedBytes>addRemovalListener in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>listener - listener that invoked of removed entriespublic void removeRemovalListener(Object listener)
InternalDataContainerInternalDataContainer.addRemovalListener(Consumer).removeRemovalListener in interface InternalDataContainer<WrappedBytes,WrappedBytes>removeRemovalListener in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>listener - the listener to removepublic void addSegments(IntSet segments)
InternalDataContaineraddSegments in interface InternalDataContainer<WrappedBytes,WrappedBytes>addSegments in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments to associate with this containerpublic void removeSegments(IntSet segments)
InternalDataContainerInternalDataContainer.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).
removeSegments in interface InternalDataContainer<WrappedBytes,WrappedBytes>removeSegments in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>segments - segments that should no longer be associated with this containerCopyright © 2022 JBoss by Red Hat. All rights reserved.