Package org.infinispan.container.offheap
Class OffHeapConcurrentMap
- java.lang.Object
-
- org.infinispan.container.offheap.OffHeapConcurrentMap
-
- All Implemented Interfaces:
ConcurrentMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
,Map<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
,org.infinispan.commons.api.Lifecycle
,org.infinispan.commons.util.PeekableMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
,PeekableTouchableMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
,TouchableMap
public class OffHeapConcurrentMap extends Object implements ConcurrentMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>, PeekableTouchableMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>, org.infinispan.commons.api.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
compute(org.infinispan.commons.marshall.WrappedBytes key, BiFunction<? super org.infinispan.commons.marshall.WrappedBytes,? super InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>,? extends InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>> remappingFunction)
boolean
containsKey(Object key)
boolean
containsValue(Object value)
Set<Map.Entry<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>>
entrySet()
InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
get(Object key)
StripedLock
getLocks()
boolean
isEmpty()
Set<org.infinispan.commons.marshall.WrappedBytes>
keySet()
InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
peek(Object key)
Peaks at a value for the given key.InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
put(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> value)
void
putAll(Map<? extends org.infinispan.commons.marshall.WrappedBytes,? extends InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>> m)
InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
putIfAbsent(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> value)
InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
remove(Object key)
boolean
remove(Object key, Object value)
InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
replace(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> value)
boolean
replace(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> oldValue, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> newValue)
int
size()
void
start()
Invoked on component startvoid
stop()
Invoked on component stopboolean
touchKey(Object key, long currentTimeMillis)
Touches the entry for the given key in this map.Collection<InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
values()
-
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: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 interfaceTouchableMap
- 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:org.infinispan.commons.api.Lifecycle
Invoked on component start- Specified by:
start
in interfaceorg.infinispan.commons.api.Lifecycle
-
stop
public void stop()
Description copied from interface:org.infinispan.commons.api.Lifecycle
Invoked on component stop- Specified by:
stop
in interfaceorg.infinispan.commons.api.Lifecycle
-
size
public int size()
- Specified by:
size
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
compute
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> compute(org.infinispan.commons.marshall.WrappedBytes key, BiFunction<? super org.infinispan.commons.marshall.WrappedBytes,? super InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>,? extends InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>> remappingFunction)
- Specified by:
compute
in interfaceConcurrentMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
- Specified by:
compute
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
get
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> get(Object key)
- Specified by:
get
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
peek
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> peek(Object key)
Description copied from interface:org.infinispan.commons.util.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 interfaceorg.infinispan.commons.util.PeekableMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
- Parameters:
key
- The key to find the value for- Returns:
- The value mapping to this key
-
put
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> put(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> value)
- Specified by:
put
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
remove
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> remove(Object key)
- Specified by:
remove
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
putAll
public void putAll(Map<? extends org.infinispan.commons.marshall.WrappedBytes,? extends InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>> m)
- Specified by:
putAll
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
putIfAbsent
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> putIfAbsent(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> value)
- Specified by:
putIfAbsent
in interfaceConcurrentMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
- Specified by:
putIfAbsent
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
remove
public boolean remove(Object key, Object value)
- Specified by:
remove
in interfaceConcurrentMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
- Specified by:
remove
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
replace
public boolean replace(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> oldValue, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> newValue)
- Specified by:
replace
in interfaceConcurrentMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
- Specified by:
replace
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
replace
public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> replace(org.infinispan.commons.marshall.WrappedBytes key, InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> value)
- Specified by:
replace
in interfaceConcurrentMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
- Specified by:
replace
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
keySet
public Set<org.infinispan.commons.marshall.WrappedBytes> keySet()
- Specified by:
keySet
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
values
public Collection<InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>> values()
- Specified by:
values
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
entrySet
public Set<Map.Entry<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>> entrySet()
- Specified by:
entrySet
in interfaceMap<org.infinispan.commons.marshall.WrappedBytes,InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>
-
-