Package org.infinispan.container.impl
Class BoundedSegmentedDataContainer<K,V> 
java.lang.Object
org.infinispan.container.impl.AbstractInternalDataContainer<K,V>
 
org.infinispan.container.impl.DefaultSegmentedDataContainer<K,V>
 
org.infinispan.container.impl.BoundedSegmentedDataContainer<K,V> 
- All Implemented Interfaces:
- Iterable<InternalCacheEntry<K,,- V>> - DataContainer<K,,- V> - InternalDataContainer<K,- V> 
Bounded implementation of segmented data container. Bulk operations (iterator|spliterator) that are given segments
 use the segments maps directly to only read the given segments (non segment based just read from bounded container).
 
Note this implementation supports both temporary non owned segments and not (L1). This map only utilizes heap based (ie. ConcurrentHashMap) maps internally
- Since:
- 9.3
- Author:
- wburns
- 
Nested Class SummaryNested classes/interfaces inherited from class org.infinispan.container.impl.AbstractInternalDataContainerAbstractInternalDataContainer.EntryIteratorNested classes/interfaces inherited from interface org.infinispan.container.DataContainerDataContainer.ComputeAction<K,V> 
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final PeekableTouchableMap<K, V> protected final com.github.benmanes.caffeine.cache.Cache<K, InternalCacheEntry<K, V>> Fields inherited from class org.infinispan.container.impl.DefaultSegmentedDataContainermaps, mapSupplier, shouldStopSegmentsFields inherited from class org.infinispan.container.impl.AbstractInternalDataContainerconfiguration, entryFactory, evictionManager, expirationManager, keyPartitioner, listeners, orderer, passivator, timeService
- 
Constructor SummaryConstructorsConstructorDescriptionBoundedSegmentedDataContainer(int numSegments, long thresholdSize, EntrySizeCalculator<? super K, ? super InternalCacheEntry<K, V>> sizeCalculator) BoundedSegmentedDataContainer(int numSegments, long thresholdSize, EvictionType thresholdPolicy) 
- 
Method SummaryModifier and TypeMethodDescriptionlongcapacity()Returns the capacity of the underlying container.voidcleanUp()Method used to cleanup any pending data, such as evictionsvoidclear()Removes all entries in the containervoidRemoves entries from the container whose key maps to one of the provided segmentsprotected voidcomputeEntryRemoved(int segment, K key, InternalCacheEntry<K, V> value) protected voidcomputeEntryRemoved(K key, InternalCacheEntry<K, V> value) This method is invoked every time an entry is removed inside a compute blockprotected voidcomputeEntryWritten(int segment, K key, InternalCacheEntry<K, V> value) protected voidcomputeEntryWritten(K key, InternalCacheEntry<K, V> value) This method is invoked every time an entry is written inside a compute blocklongReturns how large the eviction size is currently.getMapForSegment(int segment) Same asDataContainer.iterator()except that is also returns expired entries.iteratorIncludingExpired(IntSet segments) Same asDataContainer.iteratorIncludingExpired()except that only entries that map to the provided segments are returned via the iterator.Retrieves a cache entry in the same way asDataContainer.get(Object)} except that it does not update or reorder any of the internal constructs.protected voidputEntryInMap(PeekableTouchableMap<K, V> map, int segment, K key, InternalCacheEntry<K, V> ice) protected InternalCacheEntry<K, V> removeEntryInMap(PeekableTouchableMap<K, V> map, int segment, Object key) voidremoveSegments(IntSet segments) Removes and un-associates the given segments.voidresize(long newSize) Resizes the capacity of the underlying container.intSame asDataContainer.spliterator()except that is also returns expired entries.spliteratorIncludingExpired(IntSet segments) Same asDataContainer.spliteratorIncludingExpired()except that only entries that map to the provided segments are returned via this spliterator.Methods inherited from class org.infinispan.container.impl.DefaultSegmentedDataContaineraddSegments, forEach, forEachSegment, getSegmentForKey, iterator, iterator, publisher, publisher, sizeIncludingExpired, spliterator, spliterator, start, stopMethods inherited from class org.infinispan.container.impl.AbstractInternalDataContaineraddRemovalListener, applyListener, compute, compute, containsKey, containsKey, entryAdded, entryRemoved, entryUpdated, evict, evict, expiredIterationPredicate, filterExpiredEntries, get, get, handleEviction, hasExpirable, peek, put, put, remove, remove, removeRemovalListener, segmentRemoved, touchMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.container.DataContainersizeMethods inherited from interface org.infinispan.container.impl.InternalDataContainersize
- 
Field Details- 
evictionCache
- 
entries
 
- 
- 
Constructor Details- 
BoundedSegmentedDataContainerpublic BoundedSegmentedDataContainer(int numSegments, long thresholdSize, EvictionType thresholdPolicy) 
- 
BoundedSegmentedDataContainerpublic BoundedSegmentedDataContainer(int numSegments, long thresholdSize, EntrySizeCalculator<? super K, ? super InternalCacheEntry<K, V>> sizeCalculator) 
 
- 
- 
Method Details- 
computeEntryWrittenDescription copied from class:AbstractInternalDataContainerThis method is invoked every time an entry is written inside a compute block- Overrides:
- computeEntryWrittenin class- AbstractInternalDataContainer<K,- V> 
- Parameters:
- key- key passed to compute method
- value- the new value
 
- 
computeEntryWritten
- 
computeEntryRemovedDescription copied from class:AbstractInternalDataContainerThis method is invoked every time an entry is removed inside a compute block- Overrides:
- computeEntryRemovedin class- AbstractInternalDataContainer<K,- V> 
- Parameters:
- key- key passed to compute method
- value- the old value
 
- 
computeEntryRemoved
- 
putEntryInMapprotected void putEntryInMap(PeekableTouchableMap<K, V> map, int segment, K key, InternalCacheEntry<K, V> ice) - Overrides:
- putEntryInMapin class- AbstractInternalDataContainer<K,- V> 
 
- 
removeEntryInMapprotected InternalCacheEntry<K,V> removeEntryInMap(PeekableTouchableMap<K, V> map, int segment, Object key) - Overrides:
- removeEntryInMapin class- AbstractInternalDataContainer<K,- V> 
 
- 
getMapForSegment- Overrides:
- getMapForSegmentin class- DefaultSegmentedDataContainer<K,- V> 
 
- 
peekDescription copied from interface:DataContainerRetrieves 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:
- peekin interface- DataContainer<K,- V> 
- Overrides:
- peekin class- AbstractInternalDataContainer<K,- V> 
- Parameters:
- k- key under which entry is stored
- Returns:
- entry, if it exists, or null if not
 
- 
clearpublic void clear()Description copied from interface:DataContainerRemoves all entries in the container- Specified by:
- clearin interface- DataContainer<K,- V> 
- Overrides:
- clearin class- DefaultSegmentedDataContainer<K,- V> 
 
- 
clearDescription copied from interface:InternalDataContainerRemoves entries from the container whose key maps to one of the provided segments- Specified by:
- clearin interface- InternalDataContainer<K,- V> 
- Overrides:
- clearin class- AbstractInternalDataContainer<K,- V> 
- Parameters:
- segments- segments of entries to remove
 
- 
iteratorIncludingExpiredDescription copied from interface:DataContainerSame asDataContainer.iterator()except that is also returns expired entries.- Specified by:
- iteratorIncludingExpiredin interface- DataContainer<K,- V> 
- Overrides:
- iteratorIncludingExpiredin class- DefaultSegmentedDataContainer<K,- V> 
- Returns:
- iterator that returns all entries including expired ones
 
- 
iteratorIncludingExpiredDescription copied from interface:InternalDataContainerSame asDataContainer.iteratorIncludingExpired()except that only entries that map to the provided segments are returned via the iterator. The iterator can return expired entries.- Specified by:
- iteratorIncludingExpiredin interface- InternalDataContainer<K,- V> 
- Overrides:
- iteratorIncludingExpiredin class- DefaultSegmentedDataContainer<K,- V> 
- Parameters:
- segments- segments of entries to use
- Returns:
- iterator that returns all entries mapped to the given segments that could be expired
 
- 
spliteratorIncludingExpiredDescription copied from interface:DataContainerSame asDataContainer.spliterator()except that is also returns expired entries.- Specified by:
- spliteratorIncludingExpiredin interface- DataContainer<K,- V> 
- Overrides:
- spliteratorIncludingExpiredin class- DefaultSegmentedDataContainer<K,- V> 
- Returns:
- spliterator that returns all entries including expired ones
 
- 
spliteratorIncludingExpiredDescription copied from interface:InternalDataContainerSame 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.- Specified by:
- spliteratorIncludingExpiredin interface- InternalDataContainer<K,- V> 
- Overrides:
- spliteratorIncludingExpiredin class- DefaultSegmentedDataContainer<K,- V> 
- Parameters:
- segments- segments of entries to use
- Returns:
- spliterator containing entries mapping to those segments that could be expired
 
- 
sizeIncludingExpiredpublic int sizeIncludingExpired()- Specified by:
- sizeIncludingExpiredin interface- DataContainer<K,- V> 
- Overrides:
- sizeIncludingExpiredin class- DefaultSegmentedDataContainer<K,- V> 
- Returns:
- count of the number of entries in the container including expired entries
 
- 
removeSegmentsDescription copied from interface:InternalDataContainerRemoves 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).- Specified by:
- removeSegmentsin interface- InternalDataContainer<K,- V> 
- Overrides:
- removeSegmentsin class- DefaultSegmentedDataContainer<K,- V> 
- Parameters:
- segments- segments that should no longer be associated with this container
 
- 
capacitypublic 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.- Returns:
 
- 
resizepublic void resize(long newSize) Description copied from interface:DataContainerResizes the capacity of the underlying container. This is only supported if the container is bounded. AnUnsupportedOperationExceptionis thrown otherwise.- Parameters:
- newSize- the new size
 
- 
evictionSizepublic 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()- Returns:
- how large the counted eviction is
 
- 
cleanUppublic void cleanUp()Description copied from interface:InternalDataContainerMethod used to cleanup any pending data, such as evictions
 
-