Class WeakConcurrentMap.WithInlinedExpunction<K,V>
java.lang.Object
java.lang.ref.ReferenceQueue<K>
io.opentelemetry.instrumentation.api.internal.cache.weaklockfree.WeakConcurrentMap<K,V>
io.opentelemetry.instrumentation.api.internal.cache.weaklockfree.WeakConcurrentMap.WithInlinedExpunction<K,V>
- Enclosing class:
- WeakConcurrentMap<K,
V>
A
WeakConcurrentMap where stale entries are removed as a side effect of interacting
with this map.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.opentelemetry.instrumentation.api.internal.cache.weaklockfree.WeakConcurrentMap
WeakConcurrentMap.WithInlinedExpunction<K,V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns 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.computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) booleancontainsKey(K key) protected VdefaultValue(K key) Creates a default value.voidCleans all unused references.getIfPresent(K key) iterator()putIfAbsent(K key, V value) putIfProbablyAbsent(K key, V value) voidrun()toString()Methods inherited from class io.opentelemetry.instrumentation.api.internal.cache.weaklockfree.WeakConcurrentMap
getCleanerThread, getLookupKey, resetLookupKeyMethods inherited from class java.lang.ref.ReferenceQueue
poll, remove, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
WithInlinedExpunction
public WithInlinedExpunction()
-
-
Method Details
-
get
- Parameters:
key- The key of the entry.- Returns:
- The value of the entry or the default value if it did not exist.
-
getIfPresent
- Parameters:
key- The key of the entry.- Returns:
- The value of the entry or null if it did not exist.
-
containsKey
- Parameters:
key- The key of the entry.- Returns:
trueif the key already defines a value.
-
put
- Parameters:
key- The key of the entry.value- The value of the entry.- Returns:
- The previous entry or
nullif it does not exist.
-
putIfAbsent
- Parameters:
key- The key of the entry.value- The value of the entry.- Returns:
- The previous entry or
nullif it does not exist.
-
remove
- Parameters:
key- The key of the entry.- Returns:
- The removed entry or
nullif it does not exist.
-
iterator
-
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.
-
computeIfAbsent
-
putIfProbablyAbsent
- 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
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. -
run
public void run() -
toString
-