Package org.infinispan.container.offheap
Class SegmentedBoundedOffHeapDataContainer
java.lang.Object
org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer
- All Implemented Interfaces:
Iterable<InternalCacheEntry<WrappedBytes,
,WrappedBytes>> DataContainer<WrappedBytes,
,WrappedBytes> InternalDataContainer<WrappedBytes,
WrappedBytes>
- Direct Known Subclasses:
BoundedOffHeapDataContainer
public class SegmentedBoundedOffHeapDataContainer
extends AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
- Since:
- 9.4
- Author:
- wburns
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.container.DataContainer
DataContainer.ComputeAction<K,
V> -
Field Summary
Modifier and TypeFieldDescriptionprotected OffHeapMemoryAllocator
protected long
protected DefaultSegmentedDataContainer
protected EvictionManager
protected long
protected long
protected final Lock
protected final long
protected final int
protected OffHeapEntryFactory
protected DataOperationOrderer
protected ComponentRef
<PassivationManager> protected final boolean
-
Constructor Summary
ConstructorDescriptionSegmentedBoundedOffHeapDataContainer
(int numSegments, long maxSize, EvictionType type) -
Method Summary
Modifier and TypeMethodDescriptionlong
capacity()
Returns the capacity of the underlying container.compute
(int segment, WrappedBytes key, DataContainer.ComputeAction<WrappedBytes, WrappedBytes> action) Same asDataContainer.compute(Object, ComputeAction)
except that the segment of the key can provided to update entries without calculating the segment for the given key.compute
(WrappedBytes key, DataContainer.ComputeAction<WrappedBytes, WrappedBytes> action) Computes the new value for the key.protected InternalDataContainer
<WrappedBytes, WrappedBytes> delegate()
long
Returns how large the eviction size is currently.protected OffHeapConcurrentMap
getMapThatContainsKey
(byte[] key) long
getSize
(long address) void
put
(int segment, WrappedBytes key, WrappedBytes value, Metadata metadata, PrivateMetadata internalMetadata, long createdTimestamp, long lastUseTimestamp) Same asDataContainer.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.void
start()
void
stop()
Methods inherited from class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer
addRemovalListener, addSegments, clear, clear, containsKey, containsKey, evict, evict, forEach, forEach, forEachSegment, get, get, hasExpirable, iterator, iterator, iteratorIncludingExpired, iteratorIncludingExpired, peek, peek, remove, remove, removeRemovalListener, removeSegments, resize, size, size, sizeIncludingExpired, sizeIncludingExpired, spliterator, spliterator, spliteratorIncludingExpired, spliteratorIncludingExpired, touch
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.impl.InternalDataContainer
cleanUp, publisher, publisher
-
Field Details
-
allocator
-
offHeapEntryFactory
-
evictionManager
-
passivator
-
orderer
-
maxSize
protected final long maxSize -
lruLock
-
useCount
protected final boolean useCount -
numSegments
protected final int numSegments -
currentSize
protected volatile long currentSize -
firstAddress
protected long firstAddress -
lastAddress
protected long lastAddress -
dataContainer
-
-
Constructor Details
-
SegmentedBoundedOffHeapDataContainer
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
delegate
- Specified by:
delegate
in classAbstractDelegatingInternalDataContainer<WrappedBytes,
WrappedBytes>
-
put
Description copied from interface:DataContainer
Puts an entry in the cache along with metadata adding information such lifespan of entry, max idle time, version information...etc.- Specified by:
put
in interfaceDataContainer<WrappedBytes,
WrappedBytes> - Overrides:
put
in classAbstractDelegatingInternalDataContainer<WrappedBytes,
WrappedBytes> - Parameters:
key
- key under which to store entryvalue
- value to storemetadata
- metadata of the entry
-
put
public void put(int segment, WrappedBytes key, WrappedBytes value, Metadata metadata, PrivateMetadata internalMetadata, long createdTimestamp, long lastUseTimestamp) Description copied from interface:InternalDataContainer
Same asDataContainer.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.
- Specified by:
put
in interfaceInternalDataContainer<WrappedBytes,
WrappedBytes> - Overrides:
put
in classAbstractDelegatingInternalDataContainer<WrappedBytes,
WrappedBytes> - Parameters:
segment
- segment for the keykey
- key under which to store entryvalue
- value to storemetadata
- metadata of the entryinternalMetadata
-createdTimestamp
- creation timestamp, or-1
to use the current timelastUseTimestamp
- last use timestamp, or-1
to use the current time
-
compute
public InternalCacheEntry<WrappedBytes,WrappedBytes> compute(WrappedBytes key, DataContainer.ComputeAction<WrappedBytes, WrappedBytes> action) Description copied from interface:DataContainer
Computes the new value for the key. SeeDataContainer.ComputeAction.compute(Object, org.infinispan.container.entries.InternalCacheEntry, InternalEntryFactory)
.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<WrappedBytes,
WrappedBytes> - Overrides:
compute
in classAbstractDelegatingInternalDataContainer<WrappedBytes,
WrappedBytes> - Parameters:
key
- The key.action
- The action that will compute the new value.- Returns:
- The
InternalCacheEntry
associated to the key.
-
compute
public InternalCacheEntry<WrappedBytes,WrappedBytes> compute(int segment, WrappedBytes key, DataContainer.ComputeAction<WrappedBytes, WrappedBytes> action) Description copied from interface:InternalDataContainer
Same asDataContainer.compute(Object, ComputeAction)
except that the segment of the key can provided to update entries without calculating the segment for the given key.- Specified by:
compute
in interfaceInternalDataContainer<WrappedBytes,
WrappedBytes> - Overrides:
compute
in classAbstractDelegatingInternalDataContainer<WrappedBytes,
WrappedBytes> - Parameters:
segment
- segment for the keykey
- The key.action
- The action that will compute the new value.- Returns:
- The
InternalCacheEntry
associated to the key.
-
getMapThatContainsKey
-
getSize
public long getSize(long address) -
capacity
public long capacity()Description copied from interface:DataContainer
Returns the capacity of the underlying container. This is only supported if the container is bounded. AnUnsupportedOperationException
is thrown otherwise.- Specified by:
capacity
in interfaceDataContainer<WrappedBytes,
WrappedBytes> - Overrides:
capacity
in classAbstractDelegatingInternalDataContainer<WrappedBytes,
WrappedBytes> - Returns:
-
evictionSize
public long evictionSize()Description copied from interface:DataContainer
Returns how large the eviction size is currently. This is only supported if the container is bounded. AnUnsupportedOperationException
is thrown otherwise. This value will always be lower than the value returned fromDataContainer.capacity()
- Specified by:
evictionSize
in interfaceDataContainer<WrappedBytes,
WrappedBytes> - Overrides:
evictionSize
in classAbstractDelegatingInternalDataContainer<WrappedBytes,
WrappedBytes> - Returns:
- how large the counted eviction is
-