Package org.infinispan.container.offheap
Class BoundedOffHeapDataContainer
- java.lang.Object
-
- org.infinispan.container.impl.AbstractDelegatingDataContainer<K,V>
-
- org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
-
- org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer
-
- org.infinispan.container.offheap.BoundedOffHeapDataContainer
-
- All Implemented Interfaces:
Iterable<InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
,DataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
,InternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
public class BoundedOffHeapDataContainer extends SegmentedBoundedOffHeapDataContainer
- Since:
- 9.4
- Author:
- wburns
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.container.DataContainer
DataContainer.ComputeAction<K,V>
-
-
Field Summary
-
Fields inherited from class org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer
allocator, currentSize, dataContainer, evictionManager, firstAddress, lastAddress, lruLock, maxSize, offHeapEntryFactory, passivator, useCount
-
-
Constructor Summary
Constructors Constructor Description BoundedOffHeapDataContainer(int addressCount, long maxSize, EvictionType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
compute(org.infinispan.commons.marshall.WrappedBytes key, DataContainer.ComputeAction<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> action)
Computes the new value for the key.boolean
containsKey(Object k)
Tests whether an entry exists in the containervoid
evict(org.infinispan.commons.marshall.WrappedBytes key)
Atomically, it removes the key fromDataContainer
and passivates it to persistence.InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
get(Object k)
Retrieves a cached entryprotected OffHeapConcurrentMap
getMapThatContainsKey(byte[] key)
InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
peek(Object k)
Retrieves a cache entry in the same way asDataContainer.get(Object)
} except that it does not update or reorder any of the internal constructs.InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
remove(Object k)
Removes an entry from the cachevoid
start()
-
Methods inherited from class org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer
capacity, compute, delegate, evictionSize, getSize, put, put, stop
-
Methods inherited from class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer
addRemovalListener, addSegments, clear, containsKey, evict, forEach, forEachIncludingExpired, get, iterator, iteratorIncludingExpired, peek, remove, removeRemovalListener, removeSegments, size, sizeIncludingExpired, spliterator, spliteratorIncludingExpired
-
Methods inherited from class org.infinispan.container.impl.AbstractDelegatingDataContainer
clear, entrySet, executeTask, executeTask, forEach, iterator, iteratorIncludingExpired, keySet, resize, size, sizeIncludingExpired, spliterator, spliteratorIncludingExpired, values
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.container.DataContainer
clear, entrySet, executeTask, executeTask, iterator, iteratorIncludingExpired, keySet, resize, size, sizeIncludingExpired, spliterator, spliteratorIncludingExpired, values
-
-
-
-
Constructor Detail
-
BoundedOffHeapDataContainer
public BoundedOffHeapDataContainer(int addressCount, long maxSize, EvictionType type)
-
-
Method Detail
-
start
public void start()
- Overrides:
start
in classSegmentedBoundedOffHeapDataContainer
-
getMapThatContainsKey
protected OffHeapConcurrentMap getMapThatContainsKey(byte[] key)
- Overrides:
getMapThatContainsKey
in classSegmentedBoundedOffHeapDataContainer
-
containsKey
public boolean containsKey(Object k)
Description copied from interface:DataContainer
Tests whether an entry exists in the container- Specified by:
containsKey
in interfaceDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Overrides:
containsKey
in classAbstractDelegatingDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Parameters:
k
- key to test- Returns:
- true if entry exists and has not expired; false otherwise
-
peek
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> peek(Object k)
Description copied from interface:DataContainer
Retrieves a cache entry in the same way asDataContainer.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 ofDataContainer.get(Object)
} when called while iterating through the data container using methods likeDataContainer.iterator()
to avoid changing the underlying collection's order.- Specified by:
peek
in interfaceDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Overrides:
peek
in classAbstractDelegatingDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Parameters:
k
- key under which entry is stored- Returns:
- entry, if it exists, or null if not
-
get
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> get(Object k)
Description copied from interface:DataContainer
Retrieves a cached entry- Specified by:
get
in interfaceDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Overrides:
get
in classAbstractDelegatingDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Parameters:
k
- key under which entry is stored- Returns:
- entry, if it exists and has not expired, or null if not
-
compute
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> compute(org.infinispan.commons.marshall.WrappedBytes key, DataContainer.ComputeAction<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> action)
Description copied from interface:DataContainer
Computes the new value for the key. SeeDataContainer.ComputeAction.compute(Object, org.infinispan.container.entries.InternalCacheEntry, InternalEntryFactory)
. Thekey
must be activate by invokingActivationManager.onRemove(Object, boolean)
orActivationManager.onUpdate(Object, boolean)
depending if the value returned by theDataContainer.ComputeAction
is null or not respectively.Note the entry provided to
DataContainer.ComputeAction
may be expired as these entries are not filtered as many other methods do.- Specified by:
compute
in interfaceDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Overrides:
compute
in classSegmentedBoundedOffHeapDataContainer
- Parameters:
key
- The key.action
- The action that will compute the new value.- Returns:
- The
InternalCacheEntry
associated to the key.
-
remove
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> remove(Object k)
Description copied from interface:DataContainer
Removes an entry from the cache Thekey
must be activate by invokingActivationManager.onRemove(Object, boolean)
.- Specified by:
remove
in interfaceDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Overrides:
remove
in classAbstractDelegatingDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Parameters:
k
- key to remove- Returns:
- entry removed, or null if it didn't exist or had expired
-
evict
public void evict(org.infinispan.commons.marshall.WrappedBytes key)
Description copied from interface:DataContainer
Atomically, it removes the key fromDataContainer
and passivates it to persistence. The passivation must be done by invoking the methodPassivationManager.passivate(org.infinispan.container.entries.InternalCacheEntry)
.- Specified by:
evict
in interfaceDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Overrides:
evict
in classAbstractDelegatingDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
- Parameters:
key
- The key to evict.
-
-