com.sun.ejb.containers.util.pool
Interface Pool

All Known Implementing Classes:
AbstractPool, BoundedPool, 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 Summary
 void destroyObject(Object obj)
          Destroys an Object.
 Object getObject(boolean canWait, Object param)
          Deprecated.  
 Object getObject(long maxWaitTime, Object param)
          Deprecated.  
 Object getObject(Object param)
          Get an object from the pool within the specified time.
 void returnObject(Object obj)
          Return an object back to the pool.
 

Method Detail

getObject

Object getObject(boolean canWait,
                 Object param)
                 throws PoolException
Deprecated. 

Throws:
PoolException

getObject

Object getObject(long maxWaitTime,
                 Object param)
                 throws PoolException
Deprecated. 

Throws:
PoolException

getObject

Object getObject(Object param)
                 throws PoolException
Get an object from the pool within the specified time.

Parameters:
The - amount of time the calling thread agrees to wait.
Some - value that might be used while creating the object
Returns:
an Object or null if an object could not be returned in 'waitForMillis' millisecond.
Throws:
Throws - PoolException if an object cannot be created
PoolException

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).


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.



Copyright © 2012 GlassFish Community. All Rights Reserved.