Class ConcurrentPool<T>

  • All Implemented Interfaces:
    Pool<T>

    public final class ConcurrentPool<T>
    extends Object
    implements Pool<T>
    Author:
    Philipp Meinen
    • Constructor Detail

      • ConcurrentPool

        public ConcurrentPool​(ObjectManager<T> manager,
                              int maxEntries,
                              boolean softRefs,
                              int concurrencyLevel)
    • Method Detail

      • take

        public T take()
        Description copied from interface: Pool
        Take an object from the object-pool.
        Specified by:
        take in interface Pool<T>
        Returns:
        A free and usable object from the pool if one exists. Otherwise a new object is created from the underlying manager.
      • recycle

        public void recycle​(T value)
        Description copied from interface: Pool
        Recycles an object which might be reused. The caller must not use this object after calling this method.
        Specified by:
        recycle in interface Pool<T>
        Parameters:
        value - The object to be recycled.
      • getPoolStats

        public PoolStats getPoolStats()
        Specified by:
        getPoolStats in interface Pool<T>
        Returns:
        This pool's statistics object. Calls to this pool's methods are visible to successive calls to this statics-object's methods.
      • getNumPooled

        public int getNumPooled()
        Specified by:
        getNumPooled in interface Pool<T>
        Returns:
        The number of currently pooled objects.
      • clear

        public void clear()
        Description copied from interface: Pool
        instructs the pool to destroy all pooled objects.
        Specified by:
        clear in interface Pool<T>
      • getConcurrency

        public int getConcurrency()