Class MappedPool<K,​V,​E extends Exception>

  • Type Parameters:
    K - key
    V - value type to be pooled
    E - exception that can be throw, must extend Exception

    @API(EXPERIMENTAL)
    public class MappedPool<K,​V,​E extends Exception>
    extends Object
    MappedPool Class Attempts to reuse objects organized by keys. This class can be used for objects that require thread safety but our expensive to create. The number of keys in the ConcurrentHashMap are unbounded but the queue for each key is bounded to 64. Examples include Ciphers and Compressors
    • Method Detail

      • offer

        public boolean offer​(@Nonnull
                             K key,
                             @Nonnull
                             V value)
        Offer a key with a value knowing that the queue is bounded and might not accept the offer.
        Parameters:
        key - key
        value - value offered
        Returns:
        boolean if offer was added to pool
      • getKeys

        public Set<K> getKeys()
      • getPoolSize

        public int getPoolSize​(K key)
        Pool size for the key.
        Parameters:
        key - key
        Returns:
        size of pool