Class SynchronizedPool<T>

  • All Implemented Interfaces:
    Pool<T>

    public class SynchronizedPool<T>
    extends BasicPool<T>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T acquire()
      Acquires an instance from the pool.
      void release​(T instance)
      Releases an instance to the pool.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SynchronizedPool

        public SynchronizedPool()
    • Method Detail

      • acquire

        public T acquire()
        Description copied from interface: Pool
        Acquires an instance from the pool. This returns null if the pool is empty.
        Specified by:
        acquire in interface Pool<T>
        Overrides:
        acquire in class BasicPool<T>
        Returns:
        an instance from the pool, or null if the pool is empty
      • release

        public void release​(T instance)
        Description copied from interface: Pool
        Releases an instance to the pool. This has no effect if the instance is null.
        Specified by:
        release in interface Pool<T>
        Overrides:
        release in class BasicPool<T>
        Parameters:
        instance - the instance to release