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
FieldsModifier and TypeFieldDescriptionprotected OffHeapMemoryAllocatorprotected longprotected DefaultSegmentedDataContainerprotected EvictionManagerprotected longprotected longprotected final Lockprotected final longprotected final intprotected OffHeapEntryFactoryprotected DataOperationOrdererprotected ComponentRef<PassivationManager>protected final boolean -
Constructor Summary
ConstructorsConstructorDescriptionSegmentedBoundedOffHeapDataContainer(int numSegments, long maxSize, EvictionType type) -
Method Summary
Modifier and TypeMethodDescriptionlongcapacity()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()longReturns how large the eviction size is currently.protected OffHeapConcurrentMapgetMapThatContainsKey(byte[] key) longgetSize(long address) voidput(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.voidput(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.voidstart()voidstop()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, touchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
delegatein classAbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
-
put
Description copied from interface:DataContainerPuts an entry in the cache along with metadata adding information such lifespan of entry, max idle time, version information...etc.- Specified by:
putin interfaceDataContainer<WrappedBytes,WrappedBytes> - Overrides:
putin 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:InternalDataContainerSame 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:
putin interfaceInternalDataContainer<WrappedBytes,WrappedBytes> - Overrides:
putin classAbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes> - Parameters:
segment- segment for the keykey- key under which to store entryvalue- value to storemetadata- metadata of the entrycreatedTimestamp- creation timestamp, or-1to use the current timelastUseTimestamp- last use timestamp, or-1to use the current time
-
compute
public InternalCacheEntry<WrappedBytes,WrappedBytes> compute(WrappedBytes key, DataContainer.ComputeAction<WrappedBytes, WrappedBytes> action) Description copied from interface:DataContainerComputes the new value for the key. SeeDataContainer.ComputeAction.compute(Object, org.infinispan.container.entries.InternalCacheEntry, InternalEntryFactory).Note the entry provided to
DataContainer.ComputeActionmay be expired as these entries are not filtered as many other methods do.- Specified by:
computein interfaceDataContainer<WrappedBytes,WrappedBytes> - Overrides:
computein classAbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes> - Parameters:
key- The key.action- The action that will compute the new value.- Returns:
- The
InternalCacheEntryassociated to the key.
-
compute
public InternalCacheEntry<WrappedBytes,WrappedBytes> compute(int segment, WrappedBytes key, DataContainer.ComputeAction<WrappedBytes, WrappedBytes> action) Description copied from interface:InternalDataContainerSame 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:
computein interfaceInternalDataContainer<WrappedBytes,WrappedBytes> - Overrides:
computein classAbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes> - Parameters:
segment- segment for the keykey- The key.action- The action that will compute the new value.- Returns:
- The
InternalCacheEntryassociated to the key.
-
getMapThatContainsKey
-
getSize
public long getSize(long address) -
capacity
public long capacity()Description copied from interface:DataContainerReturns the capacity of the underlying container. This is only supported if the container is bounded. AnUnsupportedOperationExceptionis thrown otherwise.- Specified by:
capacityin interfaceDataContainer<WrappedBytes,WrappedBytes> - Overrides:
capacityin classAbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes> - Returns:
-
evictionSize
public long evictionSize()Description copied from interface:DataContainerReturns how large the eviction size is currently. This is only supported if the container is bounded. AnUnsupportedOperationExceptionis thrown otherwise. This value will always be lower than the value returned fromDataContainer.capacity()- Specified by:
evictionSizein interfaceDataContainer<WrappedBytes,WrappedBytes> - Overrides:
evictionSizein classAbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes> - Returns:
- how large the counted eviction is
-