Class WeakConcurrentMap.WithInlinedExpunction<K,V>
- java.lang.Object
-
- java.lang.ref.ReferenceQueue<K>
-
- io.opentelemetry.instrumentation.api.cache.weaklockfree.WeakConcurrentMap<K,V>
-
- io.opentelemetry.instrumentation.api.cache.weaklockfree.WeakConcurrentMap.WithInlinedExpunction<K,V>
-
- Enclosing class:
- WeakConcurrentMap<K,V>
public static class WeakConcurrentMap.WithInlinedExpunction<K,V> extends WeakConcurrentMap<K,V>
AWeakConcurrentMapwhere stale entries are removed as a side effect of interacting with this map.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.opentelemetry.instrumentation.api.cache.weaklockfree.WeakConcurrentMap
WeakConcurrentMap.WithInlinedExpunction<K,V>
-
-
Constructor Summary
Constructors Constructor Description WithInlinedExpunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intapproximateSize()Returns the approximate size of this map where the returned number is at least as big as the actual number of entries.voidclear()Clears the entire map.booleancontainsKey(K key)protected VdefaultValue(K key)Creates a default value.voidexpungeStaleEntries()Cleans all unused references.Vget(K key)VgetIfPresent(K key)Iterator<Map.Entry<K,V>>iterator()Vput(K key, V value)VputIfAbsent(K key, V value)VputIfProbablyAbsent(K key, V value)Vremove(K key)voidrun()StringtoString()-
Methods inherited from class io.opentelemetry.instrumentation.api.cache.weaklockfree.WeakConcurrentMap
getCleanerThread, getLookupKey, resetLookupKey
-
Methods inherited from class java.lang.ref.ReferenceQueue
poll, remove, remove
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
get
public V get(K key)
- Parameters:
key- The key of the entry.- Returns:
- The value of the entry or the default value if it did not exist.
-
containsKey
public boolean containsKey(K key)
- Parameters:
key- The key of the entry.- Returns:
trueif the key already defines a value.
-
put
public V put(K key, V value)
- Parameters:
key- The key of the entry.value- The value of the entry.- Returns:
- The previous entry or
nullif it does not exist.
-
remove
public V remove(K key)
- Parameters:
key- The key of the entry.- Returns:
- The removed entry or
nullif it does not exist.
-
approximateSize
public int approximateSize()
Returns the approximate size of this map where the returned number is at least as big as the actual number of entries.- Returns:
- The minimum size of this map.
-
getIfPresent
public V getIfPresent(K key)
- Parameters:
key- The key of the entry.- Returns:
- The value of the entry or null if it did not exist.
-
putIfAbsent
public V putIfAbsent(K key, V value)- Parameters:
key- The key of the entry.value- The value of the entry.- Returns:
- The previous entry or
nullif it does not exist.
-
putIfProbablyAbsent
public V putIfProbablyAbsent(K key, V value)- Parameters:
key- The key of the entry.value- The value of the entry.- Returns:
- The previous entry or
nullif it does not exist.
-
clear
public void clear()
Clears the entire map.
-
defaultValue
protected V defaultValue(K key)
Creates a default value. There is no guarantee that the requested value will be set as a once it is created in case that another thread requests a value for a key concurrently.- Parameters:
key- The key for which to create a default value.- Returns:
- The default value for a key without value or
nullfor not defining a default value.
-
expungeStaleEntries
public void expungeStaleEntries()
Cleans all unused references.
-
-