Class WeakIdentityConcurrentMap<K,​V>

  • Type Parameters:
    K - The key type
    V - The value type

    public final class WeakIdentityConcurrentMap<K,​V>
    extends java.lang.Object
    A poor man's implementation of a WeakIdentityConcurrentMap to hold the CacheManager associated ExecutorServices
    • Field Detail

      • map

        private final java.util.concurrent.ConcurrentMap<java.lang.ref.WeakReference<K>,​V> map
      • queue

        private final java.lang.ref.ReferenceQueue<K> queue
    • Constructor Detail

      • WeakIdentityConcurrentMap

        public WeakIdentityConcurrentMap()
        Constructor
    • Method Detail

      • put

        public V put​(K key,
                     V value)
        Puts into the underlying
        Parameters:
        key - key with which the specified value is to be associated
        value - 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

        public V remove​(K key)
        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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • putIfAbsent

        public V putIfAbsent​(K key,
                             V value)
        Puts into the underlying
        Parameters:
        key - key with which the specified value is to be associated
        value - 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. (A null return can also indicate that the map previously associated null with the key, if the implementation supports null values.)
      • get

        public V get​(K key)
        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

        public java.util.Set<K> keySet()
        Returns:
        a set view of the keys contained in this map
      • containsKey

        public boolean containsKey​(K key)