Interface Pool

  • All Known Implementing Classes:
    AbstractPool, BlockingPool, NonBlockingPool

    public interface Pool
    Pool defines the methods that can be used by the application to access pooled objects. The basic assumption is that all objects in the pool are identical (homogeneous). This interface defines methods for a) getting an object from the pool, b) returning an object back to the pool and, c) destroying (instead of reusing) an object. In addition to these methods, the Pool has methods for adding and removing PoolEventListeners. There are six overloaded methods for getting objects from a pool.
    • Method Detail

      • getObject

        Object getObject​(Object param)
                  throws PoolException
        Get an object from the pool within the specified time. The amount of time the calling thread agrees to wait. Some value that might be used while creating the object
        Parameters:
        param -
        Returns:
        an Object or null if an object could not be returned in 'waitForMillis' millisecond.
        Throws:
        PoolException - if an object cannot be created
      • returnObject

        void returnObject​(Object obj)
        Return an object back to the pool. An object that is obtained through getObject() must always be returned back to the pool using either returnObject(obj) or through destroyObject(obj).
        Parameters:
        obj -
      • destroyObject

        void destroyObject​(Object obj)
        Destroys an Object. Note that applications should not ignore the reference to the object that they got from getObject(). An object that is obtained through getObject() must always be returned back to the pool using either returnObject(obj) or through destroyObject(obj). This method tells that the object should be destroyed and cannot be reused.
        Parameters:
        obj -