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 interface
OffHeapConcurrentMap.EntryListener
Listener 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.TouchableMap
Touches 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:
touchKey
in 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:Lifecycle
Invoked on component start
-
stop
public void stop()
Description copied from interface:Lifecycle
Invoked on component stop
-
size
public int size()
- Specified by:
size
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in 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:
compute
in interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
- Specified by:
compute
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
get
public InternalCacheEntry<WrappedBytes,WrappedBytes> get(Object key)
- Specified by:
get
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
peek
public InternalCacheEntry<WrappedBytes,WrappedBytes> peek(Object key)
Description copied from interface:PeekableMap
Peaks 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:
peek
in 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:
put
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
remove
public InternalCacheEntry<WrappedBytes,WrappedBytes> remove(Object key)
- Specified by:
remove
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
putAll
public void putAll(Map<? extends WrappedBytes,? extends InternalCacheEntry<WrappedBytes,WrappedBytes>> m)
- Specified by:
putAll
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
putIfAbsent
public InternalCacheEntry<WrappedBytes,WrappedBytes> putIfAbsent(WrappedBytes key, InternalCacheEntry<WrappedBytes,WrappedBytes> value)
- Specified by:
putIfAbsent
in interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
- Specified by:
putIfAbsent
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
remove
public boolean remove(Object key, Object value)
- Specified by:
remove
in interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
- Specified by:
remove
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
replace
public boolean replace(WrappedBytes key, InternalCacheEntry<WrappedBytes,WrappedBytes> oldValue, InternalCacheEntry<WrappedBytes,WrappedBytes> newValue)
- Specified by:
replace
in interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
- Specified by:
replace
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
replace
public InternalCacheEntry<WrappedBytes,WrappedBytes> replace(WrappedBytes key, InternalCacheEntry<WrappedBytes,WrappedBytes> value)
- Specified by:
replace
in interfaceConcurrentMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
- Specified by:
replace
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
keySet
public Set<WrappedBytes> keySet()
- Specified by:
keySet
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
values
public Collection<InternalCacheEntry<WrappedBytes,WrappedBytes>> values()
- Specified by:
values
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
entrySet
public Set<Map.Entry<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>> entrySet()
- Specified by:
entrySet
in interfaceMap<WrappedBytes,InternalCacheEntry<WrappedBytes,WrappedBytes>>
-
-