Class WeakConcurrentMap.WithInlinedExpunction<K,V>
java.lang.Object
java.lang.ref.ReferenceQueue<K>
io.opentelemetry.context.internal.shaded.WeakConcurrentMap<K,V>
io.opentelemetry.context.internal.shaded.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.-
Nested Class Summary
Nested classes/interfaces inherited from class 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.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 WeakConcurrentMap
getCleanerThread, getLookupKey, resetLookupKeyMethods inherited from class ReferenceQueue
poll, remove, removeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
WithInlinedExpunction
public WithInlinedExpunction()
-
-
Method Details
-
get
-
containsKey
- Parameters:
key- The key of the entry.- Returns:
trueif the key already defines a value.
-
put
-
remove
-
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.
-
getIfPresent
-
putIfAbsent
-
putIfProbablyAbsent
-
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
-
toString
-