Package org.infinispan.container.offheap
Class OffHeapDataContainer
- java.lang.Object
-
- org.infinispan.container.impl.AbstractInternalDataContainer<WrappedBytes,WrappedBytes>
-
- org.infinispan.container.offheap.OffHeapDataContainer
-
- All Implemented Interfaces:
Iterable<InternalCacheEntry<WrappedBytes,WrappedBytes>>
,DataContainer<WrappedBytes,WrappedBytes>
,org.infinispan.container.impl.InternalDataContainer<WrappedBytes,WrappedBytes>
public class OffHeapDataContainer extends org.infinispan.container.impl.AbstractInternalDataContainer<WrappedBytes,WrappedBytes>
- Since:
- 9.4
- Author:
- wburns
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.infinispan.container.impl.AbstractInternalDataContainer
org.infinispan.container.impl.AbstractInternalDataContainer.EntryIterator, org.infinispan.container.impl.AbstractInternalDataContainer.Values
-
Nested classes/interfaces inherited from interface org.infinispan.container.DataContainer
DataContainer.ComputeAction<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description protected OffHeapMemoryAllocator
allocator
protected OffHeapEntryFactory
offHeapEntryFactory
-
Constructor Summary
Constructors Constructor Description OffHeapDataContainer(int desiredSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSegments(IntSet segments)
Sets what segments this data container should be using.void
clear()
Removes all entries in the containerstatic int
getActualAddressCount(int desiredSize)
protected org.infinispan.container.impl.PeekableTouchableMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
getMapForSegment(int segment)
protected int
getSegmentForKey(Object key)
Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
iterator()
Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
iterator(IntSet segments)
Same asDataContainer.iterator()
except that only entries that map to the provided segments are returned via the iterator.Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
iteratorIncludingExpired()
Same asDataContainer.iterator()
except that is also returns expired entries.Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
iteratorIncludingExpired(IntSet segments)
Same asDataContainer.iteratorIncludingExpired()
except that only entries that map to the provided segments are returned via the iterator.void
removeSegments(IntSet segments)
Removes and un-associates the given segments.int
sizeIncludingExpired()
Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
spliterator()
Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
spliterator(IntSet segments)
Same asDataContainer.spliterator()
except that only entries that map to the provided segments are returned via this spliterator.Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
spliteratorIncludingExpired()
Same asDataContainer.spliterator()
except that is also returns expired entries.Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>>
spliteratorIncludingExpired(IntSet segments)
Same asDataContainer.spliteratorIncludingExpired()
except that only entries that map to the provided segments are returned via this spliterator.void
start()
void
stop()
-
Methods inherited from class org.infinispan.container.impl.AbstractInternalDataContainer
addRemovalListener, applyListener, clear, compute, compute, computeEntryRemoved, computeEntryWritten, containsKey, containsKey, entrySet, evict, evict, expiredIterationPredicate, filterExpiredEntries, get, get, keySet, peek, peek, put, put, remove, remove, removeRemovalListener, touch, 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
capacity, evictionSize, executeTask, executeTask, resize, size
-
-
-
-
Field Detail
-
allocator
protected OffHeapMemoryAllocator allocator
-
offHeapEntryFactory
protected OffHeapEntryFactory offHeapEntryFactory
-
-
Method Detail
-
getActualAddressCount
public static int getActualAddressCount(int desiredSize)
-
start
public void start()
-
stop
public void stop()
-
getMapForSegment
protected org.infinispan.container.impl.PeekableTouchableMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>> getMapForSegment(int segment)
- Specified by:
getMapForSegment
in classorg.infinispan.container.impl.AbstractInternalDataContainer<WrappedBytes,WrappedBytes>
-
getSegmentForKey
protected int getSegmentForKey(Object key)
- Specified by:
getSegmentForKey
in classorg.infinispan.container.impl.AbstractInternalDataContainer<WrappedBytes,WrappedBytes>
-
spliterator
public Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> spliterator()
Description copied from interface:DataContainer
This spliterator only returns entries that are not expired, however it will not remove them while doing so.
- Returns:
- spliterator that doesn't produce expired entries
-
spliterator
public Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> spliterator(IntSet segments)
Description copied from interface:org.infinispan.container.impl.InternalDataContainer
Same asDataContainer.spliterator()
except that only entries that map to the provided segments are returned via this spliterator. The spliterator will not return expired entries.- Parameters:
segments
- segments of entries to return- Returns:
- spliterator containing entries mapping to those segments that aren't expired
-
spliteratorIncludingExpired
public Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> spliteratorIncludingExpired()
Description copied from interface:DataContainer
Same asDataContainer.spliterator()
except that is also returns expired entries.- Returns:
- spliterator that returns all entries including expired ones
-
spliteratorIncludingExpired
public Spliterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> spliteratorIncludingExpired(IntSet segments)
Description copied from interface:org.infinispan.container.impl.InternalDataContainer
Same asDataContainer.spliteratorIncludingExpired()
except that only entries that map to the provided segments are returned via this spliterator. The spliterator will return expired entries as well.- Parameters:
segments
- segments of entries to use- Returns:
- spliterator containing entries mapping to those segments that could be expired
-
iterator
public Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> iterator()
Description copied from interface:DataContainer
This iterator only returns entries that are not expired, however it will not remove them while doing so.
- Returns:
- iterator that doesn't produce expired entries
-
iterator
public Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> iterator(IntSet segments)
Description copied from interface:org.infinispan.container.impl.InternalDataContainer
Same asDataContainer.iterator()
except that only entries that map to the provided segments are returned via the iterator. The iterator will not return expired entries.- Parameters:
segments
- segments of entries to use- Returns:
- iterator that returns all entries mapped to the given segments
-
iteratorIncludingExpired
public Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> iteratorIncludingExpired()
Description copied from interface:DataContainer
Same asDataContainer.iterator()
except that is also returns expired entries.- Returns:
- iterator that returns all entries including expired ones
-
iteratorIncludingExpired
public Iterator<InternalCacheEntry<WrappedBytes,WrappedBytes>> iteratorIncludingExpired(IntSet segments)
Description copied from interface:org.infinispan.container.impl.InternalDataContainer
Same asDataContainer.iteratorIncludingExpired()
except that only entries that map to the provided segments are returned via the iterator. The iterator can return expired entries.- Parameters:
segments
- segments of entries to use- Returns:
- iterator that returns all entries mapped to the given segments that could be expired
-
addSegments
public void addSegments(IntSet segments)
Description copied from interface:org.infinispan.container.impl.InternalDataContainer
Sets what segments this data container should be using. Already associated segments are unaffected by this and takes a union of existing and new segments.- Parameters:
segments
- segments to associate with this container
-
removeSegments
public void removeSegments(IntSet segments)
Description copied from interface:org.infinispan.container.impl.InternalDataContainer
Removes and un-associates the given segments. This will notify any listeners registered viaInternalDataContainer.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)
.- Parameters:
segments
- segments that should no longer be associated with this container
-
sizeIncludingExpired
public int sizeIncludingExpired()
- Returns:
- count of the number of entries in the container including expired entries
-
clear
public void clear()
Description copied from interface:DataContainer
Removes all entries in the container
-
-