public class SegmentedBoundedOffHeapDataContainer extends AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
DataContainer.ComputeAction<K,V>
Modifier and Type | Field and Description |
---|---|
protected OffHeapMemoryAllocator |
allocator |
protected long |
currentSize |
protected DefaultSegmentedDataContainer |
dataContainer |
protected EvictionManager |
evictionManager |
protected long |
firstAddress |
protected long |
lastAddress |
protected Lock |
lruLock |
protected long |
maxSize |
protected int |
numSegments |
protected OffHeapEntryFactory |
offHeapEntryFactory |
protected DataOperationOrderer |
orderer |
protected ComponentRef<PassivationManager> |
passivator |
protected boolean |
useCount |
Constructor and Description |
---|
SegmentedBoundedOffHeapDataContainer(int numSegments,
long maxSize,
EvictionType type) |
Modifier and Type | Method and Description |
---|---|
long |
capacity()
Returns the capacity of the underlying container.
|
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.
|
protected InternalDataContainer<WrappedBytes,WrappedBytes> |
delegate() |
long |
evictionSize()
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 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.
|
void |
start() |
void |
stop() |
addRemovalListener, addSegments, clear, clear, containsKey, containsKey, evict, evict, forEach, forEach, get, get, iterator, iterator, iteratorIncludingExpired, iteratorIncludingExpired, peek, peek, remove, remove, removeRemovalListener, removeSegments, resize, size, size, sizeIncludingExpired, sizeIncludingExpired, spliterator, spliterator, spliteratorIncludingExpired, spliteratorIncludingExpired, touch
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cleanUp, publisher
protected OffHeapMemoryAllocator allocator
protected OffHeapEntryFactory offHeapEntryFactory
protected EvictionManager evictionManager
protected ComponentRef<PassivationManager> passivator
protected DataOperationOrderer orderer
protected final long maxSize
protected final Lock lruLock
protected final boolean useCount
protected final int numSegments
protected volatile long currentSize
protected long firstAddress
protected long lastAddress
protected DefaultSegmentedDataContainer dataContainer
public SegmentedBoundedOffHeapDataContainer(int numSegments, long maxSize, EvictionType type)
public void start()
public void stop()
protected InternalDataContainer<WrappedBytes,WrappedBytes> delegate()
delegate
in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
public void put(WrappedBytes key, WrappedBytes value, Metadata metadata)
DataContainer
key
must be activate by invoking ActivationManager.activateAsync(Object, int)
boolean)}.put
in interface DataContainer<WrappedBytes,WrappedBytes>
put
in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
key
- key under which to store entryvalue
- value to storemetadata
- metadata of the entrypublic void put(int segment, WrappedBytes key, WrappedBytes value, Metadata metadata, PrivateMetadata internalMetadata, long createdTimestamp, long lastUseTimestamp)
InternalDataContainer
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.
Note: The timestamps ignored if the entry already exists in the data container.
put
in interface InternalDataContainer<WrappedBytes,WrappedBytes>
put
in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
segment
- 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 InternalCacheEntry<WrappedBytes,WrappedBytes> compute(WrappedBytes key, DataContainer.ComputeAction<WrappedBytes,WrappedBytes> action)
DataContainer
DataContainer.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 AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
key
- The key.action
- The action that will compute the new value.InternalCacheEntry
associated to the key.public InternalCacheEntry<WrappedBytes,WrappedBytes> compute(int segment, WrappedBytes key, DataContainer.ComputeAction<WrappedBytes,WrappedBytes> action)
InternalDataContainer
DataContainer.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 AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
segment
- segment for the keykey
- The key.action
- The action that will compute the new value.InternalCacheEntry
associated to the key.protected OffHeapConcurrentMap getMapThatContainsKey(byte[] key)
public long getSize(long address)
public long capacity()
DataContainer
UnsupportedOperationException
is thrown
otherwise.capacity
in interface DataContainer<WrappedBytes,WrappedBytes>
capacity
in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
public long evictionSize()
DataContainer
UnsupportedOperationException
is thrown otherwise. This value will always be lower than the value returned
from DataContainer.capacity()
evictionSize
in interface DataContainer<WrappedBytes,WrappedBytes>
evictionSize
in class AbstractDelegatingInternalDataContainer<WrappedBytes,WrappedBytes>
Copyright © 2021 JBoss by Red Hat. All rights reserved.