Package org.ehcache.sizeof.util
Class WeakIdentityConcurrentMap<K,V>
java.lang.Object
org.ehcache.sizeof.util.WeakIdentityConcurrentMap<K,V>
- Type Parameters:
K
- The key typeV
- The value type
A poor man's implementation of a WeakIdentityConcurrentMap to hold the CacheManager associated ExecutorServices
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final WeakIdentityConcurrentMap.CleanUpTask
<V> private final ConcurrentMap
<WeakReference<K>, V> private final ReferenceQueue
<K> -
Constructor Summary
ConstructorsConstructorDescriptionConstructorWeakIdentityConcurrentMap
(WeakIdentityConcurrentMap.CleanUpTask<V> cleanUpTask) Constructor -
Method Summary
-
Field Details
-
map
-
queue
-
cleanUpTask
-
-
Constructor Details
-
WeakIdentityConcurrentMap
public WeakIdentityConcurrentMap()Constructor -
WeakIdentityConcurrentMap
Constructor- Parameters:
cleanUpTask
- task cleaning up references
-
-
Method Details
-
put
Puts into the underlying- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key- Returns:
- the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)
-
remove
Remove from the underlying- Parameters:
key
- key whose mapping is to be removed from the map- Returns:
- the previous value associated with key, or null if there was no mapping for key.
-
toString
-
putIfAbsent
Puts into the underlying- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key- Returns:
- the previous value associated with the specified key, or
null
if there was no mapping for the key. (Anull
return can also indicate that the map previously associatednull
with the key, if the implementation supports null values.)
-
get
- Parameters:
key
- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
null
if this map contains no mapping for the key
-
cleanUp
public void cleanUp() -
keySet
- Returns:
- a set view of the keys contained in this map
-
containsKey
-