Package org.infinispan.container.offheap
Class OffHeapConcurrentMap
- java.lang.Object
-
- org.infinispan.container.offheap.OffHeapConcurrentMap
-
- All Implemented Interfaces:
ConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>,Map<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>,Lifecycle,PeekableMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>,org.infinispan.container.impl.PeekableTouchableMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>,org.infinispan.container.impl.TouchableMap
public class OffHeapConcurrentMap extends Object implements ConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>, org.infinispan.container.impl.PeekableTouchableMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>, Lifecycle
- Since:
- 9.4
- Author:
- wburns
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceOffHeapConcurrentMap.EntryListenerListener interface that is notified when certain operations occur for various memory addresses.
-
Constructor Summary
Constructors Constructor Description OffHeapConcurrentMap(int desiredSize, OffHeapMemoryAllocator allocator, OffHeapEntryFactory offHeapEntryFactory, OffHeapConcurrentMap.EntryListener listener)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
-
-
-
Constructor Detail
-
OffHeapConcurrentMap
public OffHeapConcurrentMap(int desiredSize, OffHeapMemoryAllocator allocator, OffHeapEntryFactory offHeapEntryFactory, OffHeapConcurrentMap.EntryListener listener)
-
-
Method Detail
-
touchKey
public boolean touchKey(Object key, long currentTimeMillis)
Description copied from interface:org.infinispan.container.impl.TouchableMapTouches the entry for the given key in this map. This method will update any recency timestamps for both expiration or eviction as needed.- Specified by:
touchKeyin interfaceorg.infinispan.container.impl.TouchableMap- Parameters:
key- key to touchcurrentTimeMillis- the recency timestamp to set- Returns:
- whether the entry was touched or not
-
getLocks
public StripedLock getLocks()
-
start
public void start()
Description copied from interface:LifecycleInvoked on component start
-
stop
public void stop()
Description copied from interface:LifecycleInvoked on component stop
-
size
public int size()
- Specified by:
sizein interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
compute
public InternalCacheEntry<WrappedBytes,WrappedBytes> compute(WrappedBytes key, BiFunction<? super WrappedBytes,? super InternalCacheEntry<WrappedBytes,WrappedBytes>,? extends InternalCacheEntry<WrappedBytes,WrappedBytes>> remappingFunction)
- Specified by:
computein interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>- Specified by:
computein interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
get
public InternalCacheEntry<WrappedBytes,WrappedBytes> get(Object key)
- Specified by:
getin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
peek
public InternalCacheEntry<WrappedBytes,WrappedBytes> peek(Object key)
Description copied from interface:PeekableMapPeaks at a value for the given key. Note that this does not update any expiration or eviction information when this is performed on the map, unlike the get method.- Specified by:
peekin interfacePeekableMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>- Parameters:
key- The key to find the value for- Returns:
- The value mapping to this key
-
put
public InternalCacheEntry<WrappedBytes,WrappedBytes> put(WrappedBytes key, InternalCacheEntry<WrappedBytes,WrappedBytes> value)
- Specified by:
putin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
remove
public InternalCacheEntry<WrappedBytes,WrappedBytes> remove(Object key)
- Specified by:
removein interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
putAll
public void putAll(Map<? extends WrappedBytes,? extends InternalCacheEntry<WrappedBytes,WrappedBytes>> m)
- Specified by:
putAllin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
clear
public void clear()
- Specified by:
clearin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
putIfAbsent
public InternalCacheEntry<WrappedBytes,WrappedBytes> putIfAbsent(WrappedBytes key, InternalCacheEntry<WrappedBytes,WrappedBytes> value)
- Specified by:
putIfAbsentin interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>- Specified by:
putIfAbsentin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
remove
public boolean remove(Object key, Object value)
- Specified by:
removein interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>- Specified by:
removein interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
replace
public boolean replace(WrappedBytes key, InternalCacheEntry<WrappedBytes,WrappedBytes> oldValue, InternalCacheEntry<WrappedBytes,WrappedBytes> newValue)
- Specified by:
replacein interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>- Specified by:
replacein interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
replace
public InternalCacheEntry<WrappedBytes,WrappedBytes> replace(WrappedBytes key, InternalCacheEntry<WrappedBytes,WrappedBytes> value)
- Specified by:
replacein interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>- Specified by:
replacein interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
keySet
public Set<WrappedBytes> keySet()
- Specified by:
keySetin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
values
public Collection<InternalCacheEntry<WrappedBytes,WrappedBytes>> values()
- Specified by:
valuesin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
entrySet
public Set<Map.Entry<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>> entrySet()
- Specified by:
entrySetin interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
-