public class WeakConcurrentMap<K,V> extends AbstractWeakConcurrentMap<K,V,com.blogspot.mydailyjava.weaklockfree.WeakConcurrentMap.LookupKey<K>>
A thread-safe map with weak keys. Entries are based on a key's system hash code and keys are considered equal only by reference equality.
This class does not implement theMap interface because this implementation is incompatible
with the map contract. While iterating over a map's entries, any key that has not passed iteration is referenced non-weakly.| Modifier and Type | Class and Description |
|---|---|
static class |
WeakConcurrentMap.WithInlinedExpunction<K,V>
A
WeakConcurrentMap where stale entries are removed as a side effect of interacting with this map. |
AbstractWeakConcurrentMap.WeakKey<K>| Constructor and Description |
|---|
WeakConcurrentMap(boolean cleanerThread) |
WeakConcurrentMap(boolean cleanerThread,
boolean reuseKeys) |
WeakConcurrentMap(boolean cleanerThread,
boolean reuseKeys,
ConcurrentMap<AbstractWeakConcurrentMap.WeakKey<K>,V> target) |
| Modifier and Type | Method and Description |
|---|---|
Thread |
getCleanerThread() |
protected com.blogspot.mydailyjava.weaklockfree.WeakConcurrentMap.LookupKey<K> |
getLookupKey(K key)
Override with care as it can cause lookup failures if done incorrectly.
|
protected void |
resetLookupKey(com.blogspot.mydailyjava.weaklockfree.WeakConcurrentMap.LookupKey<K> lookupKey)
Resets any reusable state in the lookup key.
|
approximateSize, clear, containsKey, defaultValue, expungeStaleEntries, get, getIfPresent, iterator, put, putIfAbsent, putIfProbablyAbsent, remove, run, toStringpoll, remove, removeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic WeakConcurrentMap(boolean cleanerThread)
cleanerThread - true if a thread should be started that removes stale entries.public WeakConcurrentMap(boolean cleanerThread,
boolean reuseKeys)
cleanerThread - true if a thread should be started that removes stale entries.reuseKeys - true if the lookup keys should be reused via a ThreadLocal.
Note that setting this to true may result in class loader leaks.
See isPersistentClassLoader(ClassLoader) for more details.public WeakConcurrentMap(boolean cleanerThread,
boolean reuseKeys,
ConcurrentMap<AbstractWeakConcurrentMap.WeakKey<K>,V> target)
cleanerThread - true if a thread should be started that removes stale entries.reuseKeys - true if the lookup keys should be reused via a ThreadLocal.
Note that setting this to true may result in class loader leaks.
See isPersistentClassLoader(ClassLoader) for more details.target - ConcurrentMap implementation that this class wraps.protected com.blogspot.mydailyjava.weaklockfree.WeakConcurrentMap.LookupKey<K> getLookupKey(K key)
AbstractWeakConcurrentMapObject.hashCode() as the input and be equal to
a weak reference of the key. When overriding this, also override AbstractWeakConcurrentMap.resetLookupKey(L).getLookupKey in class AbstractWeakConcurrentMap<K,V,com.blogspot.mydailyjava.weaklockfree.WeakConcurrentMap.LookupKey<K>>protected void resetLookupKey(com.blogspot.mydailyjava.weaklockfree.WeakConcurrentMap.LookupKey<K> lookupKey)
AbstractWeakConcurrentMapresetLookupKey in class AbstractWeakConcurrentMap<K,V,com.blogspot.mydailyjava.weaklockfree.WeakConcurrentMap.LookupKey<K>>public Thread getCleanerThread()
null if no such thread was set.Copyright © 2016–2020. All rights reserved.