|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.easybeans.pool.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.
Field Summary | |
---|---|
private java.util.List<InstanceType> |
availableList
List of available objects in the pool. |
private java.util.List<InstanceType> |
busyList
List of objects which are currently busy and not available from the pool. |
private int |
currentWaiters
Current number of waiters. |
private static int |
DEFAULT_MAX_WAITERS
Default maximum of waiters (1000). |
private static long |
DEFAULT_TIMEOUT
Default timeout (10s) in ms. |
private int |
highMaxWaiters
Maximum number of waiters during current period. |
private long |
highWaitingTime
Maximum waiting time during current period. |
private java.util.Map<InstanceType,PoolEntryStatistics> |
infoMap
Information on entries managed in the pool. |
private int |
initSize
Initial size of the pool. |
private JLog |
logger
Logger used. |
private int |
maxSize
Maximum size of the pool. |
private int |
maxWaiters
Max nb of waiters allowed to wait for an instance. |
private int |
minSize
Minimum size of the pool. |
private static int |
NO_LIMIT
High Value for no limit for the connection pool. |
private PoolFactory<InstanceType,Clue> |
poolFactory
Factory used for delegate creating, matching, removing actions. |
private int |
rejectedFull
Total nb of instance not served due to an overflow of waiters. |
private int |
rejectedTimeout
Total nb of instance not served due to timeout. |
private int |
servedInstance
Total number of instances since the pool creation. |
private boolean |
strict
Maximum size of the pool is strict. |
private int |
totalWaiters
Total nb of waiters since pool creation. |
private long |
totalWaitingTime
total waiting time in milliseconds. |
private long |
waiterTimeout
Max nb of milliseconds to wait for an object when the pool is full. |
Constructor Summary | |
---|---|
JPool(PoolFactory<InstanceType,Clue> poolFactory)
Builds a new pool. |
Method Summary | |
---|---|
void |
discard(InstanceType object)
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. |
void |
release(InstanceType instance)
Puts back the instance in the pool so it can be reused. |
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 |
Field Detail |
---|
private static final long DEFAULT_TIMEOUT
private static final int DEFAULT_MAX_WAITERS
private static final int NO_LIMIT
private JLog logger
private PoolFactory<InstanceType,Clue> poolFactory
private java.util.List<InstanceType> availableList
private java.util.List<InstanceType> busyList
private java.util.Map<InstanceType,PoolEntryStatistics> infoMap
private int minSize
private int maxSize
private int initSize
private boolean strict
private int maxWaiters
private long waiterTimeout
private int currentWaiters
private int highMaxWaiters
private int totalWaiters
private long totalWaitingTime
private long highWaitingTime
private int servedInstance
private int rejectedTimeout
private int rejectedFull
Constructor Detail |
---|
public JPool(PoolFactory<InstanceType,Clue> poolFactory)
poolFactory
- factory used for delegating create, remove, etc.Method Detail |
---|
public InstanceType get() throws PoolException
get
in interface Pool<InstanceType,Clue>
PoolException
- if instance cannot be returned.public InstanceType get(Clue clue) throws PoolException
get
in interface Pool<InstanceType,Clue>
clue
- attribute used to retrieve a given instance
PoolException
- if instance cannot be returned.public void release(InstanceType instance) throws PoolException
release
in interface Pool<InstanceType,Clue>
instance
- which will be put back in the pool.
PoolException
- if instance is not released.public void discard(InstanceType object)
discard
in interface Pool<InstanceType,Clue>
object
- which will be discarded.public void start() throws PoolException
start
in interface Pool<InstanceType,Clue>
PoolException
- if initialization failspublic void stop() throws PoolException
stop
in interface Pool<InstanceType,Clue>
PoolException
- if destroy fails
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |