|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.util.pool.impl.JPool<InstanceType,Clue>
InstanceType - the type of the object that are managed by the pool
(could be EasyBeansSLSB, etc.)Clue - a clue to retrieve a specific instance in the poolpublic class JPool<InstanceType,Clue>
Abstract pool.
Need to be extended to set-up the correct generic types used for BeanType and
Hint.
| Constructor Summary | |
|---|---|
JPool(PoolFactory<InstanceType,Clue> poolFactory)
Builds a new pool. |
|
| Method Summary | |
|---|---|
void |
discard(InstanceType instance)
Discard the instance which is in the pool. |
InstanceType |
get()
Gets an object from the pool. |
InstanceType |
get(Clue clue)
Gets an object by using a specific hint. |
boolean |
isAllowSharedInstance()
Return true if many instances of the same object can be created (when pool is not full). |
void |
release(InstanceType instance)
Puts back the instance in the pool so it can be reused. |
void |
setAllowSharedInstance(boolean allowSharedInstance)
Allow to share instances (shouldn't be use in stateful case as one stateful ID is linked to one client. |
void |
setPoolConfiguration(org.ow2.util.pool.api.IPoolConfiguration poolConfiguration)
Configure the pool with a given configuration. |
void |
start()
Start the pool. It could create initial instances if specified. |
void |
stop()
Stop this pool. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JPool(PoolFactory<InstanceType,Clue> poolFactory)
poolFactory - factory used for delegating create, remove, etc.| Method Detail |
|---|
public InstanceType get()
throws org.ow2.util.pool.api.PoolException
get in interface org.ow2.util.pool.api.Pool<InstanceType,Clue>org.ow2.util.pool.api.PoolException - if instance cannot be returned.
public InstanceType get(Clue clue)
throws org.ow2.util.pool.api.PoolException
get in interface org.ow2.util.pool.api.Pool<InstanceType,Clue>clue - attribute used to retrieve a given instance
org.ow2.util.pool.api.PoolException - if instance cannot be returned.
public void release(InstanceType instance)
throws org.ow2.util.pool.api.PoolException
release in interface org.ow2.util.pool.api.Pool<InstanceType,Clue>instance - which will be put back in the pool.
org.ow2.util.pool.api.PoolException - if instance is not released.
public void discard(InstanceType instance)
throws org.ow2.util.pool.api.PoolException
discard in interface org.ow2.util.pool.api.Pool<InstanceType,Clue>instance - which will be discarded.
org.ow2.util.pool.api.PoolException - if instance is not discardedpublic void setAllowSharedInstance(boolean allowSharedInstance)
allowSharedInstance - true if it is allowed, else false.public boolean isAllowSharedInstance()
public void setPoolConfiguration(org.ow2.util.pool.api.IPoolConfiguration poolConfiguration)
setPoolConfiguration in interface org.ow2.util.pool.api.Pool<InstanceType,Clue>poolConfiguration - the given configuration
public void start()
throws org.ow2.util.pool.api.PoolException
start in interface org.ow2.util.pool.api.Pool<InstanceType,Clue>org.ow2.util.pool.api.PoolException - if initialization fails
public void stop()
throws org.ow2.util.pool.api.PoolException
stop in interface org.ow2.util.pool.api.Pool<InstanceType,Clue>org.ow2.util.pool.api.PoolException - if destroy fails
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||