Class FixedObjectPool<T>

  • All Implemented Interfaces:
    ObjectPool<T>

    public final class FixedObjectPool<T>
    extends java.lang.Object
    implements ObjectPool<T>
    An object pool that always returns the same instance and does nothing when returning the object.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private T object  
    • Constructor Summary

      Constructors 
      Constructor Description
      FixedObjectPool​(T object)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T getObject()
      Get an object from the pool.
      T returnObject​(java.lang.Object returned)
      Return the object to the pool.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • object

        private final T object
    • Constructor Detail

      • FixedObjectPool

        public FixedObjectPool​(T object)
    • Method Detail

      • getObject

        public T getObject()
        Description copied from interface: ObjectPool
        Get an object from the pool.
        Specified by:
        getObject in interface ObjectPool<T>
      • returnObject

        public T returnObject​(java.lang.Object returned)
        Description copied from interface: ObjectPool
        Return the object to the pool. The caller should not use the object beyond this point.
        Specified by:
        returnObject in interface ObjectPool<T>
        Returns:
        always null