| java.lang.Object org.ow2.easybeans.pool.JPool
JPool | public class JPool implements Pool<InstanceType, Clue>,PoolAttributes(Code) | | Abstract pool.
Need to be extended to set-up the correct generic types used for BeanType and
Hint.
< Parameters: InstanceType - > the type of the object that are managed by the pool(could be EasyBeansSLSB, etc.)< Parameters: Clue - > a clue to retrieve a specific instance in the pool author: Florent Benoit |
Constructor Summary | |
public | JPool(PoolFactory<InstanceType, Clue> poolFactory) Builds a new pool. |
Method Summary | |
public synchronized void | discard(InstanceType instance) Discard the instance which is in the pool. | public InstanceType | get() Gets an object from the pool. | public synchronized InstanceType | get(Clue clue) Gets an object by using a specific hint. | public boolean | isAllowSharedInstance() Return true if many instances of the same object can be created (when pool is not full). | public synchronized void | release(InstanceType instance) Puts back the instance in the pool so it can be reused. | public void | setAllowSharedInstance(boolean allowSharedInstance) Allow to share instances (shouldn't be use in stateful case as one
stateful ID is linked to one client. | public void | start() Start the pool.
It could create initial instances if specified. | public void | stop() Stop this pool. |
JPool | public JPool(PoolFactory<InstanceType, Clue> poolFactory)(Code) | | Builds a new pool.
Parameters: poolFactory - factory used for delegating create, remove, etc. |
discard | public synchronized void discard(InstanceType instance) throws PoolException(Code) | | Discard the instance which is in the pool.
Parameters: instance - which will be discarded. throws: PoolException - if instance is not discarded |
get | public InstanceType get() throws PoolException(Code) | | Gets an object from the pool.
an instance of an object with type Type. throws: PoolException - if instance cannot be returned. |
get | public synchronized InstanceType get(Clue clue) throws PoolException(Code) | | Gets an object by using a specific hint.
Parameters: clue - attribute used to retrieve a given instance a specific instance of the resource. throws: PoolException - if instance cannot be returned. |
isAllowSharedInstance | public boolean isAllowSharedInstance()(Code) | | Return true if many instances of the same object can be created (when pool is not full).
true if this is allowed. |
release | public synchronized void release(InstanceType instance) throws PoolException(Code) | | Puts back the instance in the pool so it can be reused.
Parameters: instance - which will be put back in the pool. throws: PoolException - if instance is not released. |
setAllowSharedInstance | public void setAllowSharedInstance(boolean allowSharedInstance)(Code) | | Allow to share instances (shouldn't be use in stateful case as one
stateful ID is linked to one client. No Stateful with same ID are
authorized).
Parameters: allowSharedInstance - true if it is allowed, else false. |
start | public void start() throws PoolException(Code) | | Start the pool.
It could create initial instances if specified.
throws: PoolException - if initialization fails |
|
|