|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.excalibur.pool.InstrumentedResourceLimitingPool
org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool
public class TraceableResourceLimitingPool
A ResourceLimitingPool which can be configured so that it will trace the where get is being called fron. The pool can then be queried for its status.
Nested Class Summary | |
---|---|
private static class |
TraceableResourceLimitingPool.PoolElement
|
static class |
TraceableResourceLimitingPool.State
|
static class |
TraceableResourceLimitingPool.TraceException
|
Field Summary | |
---|---|
private java.util.Map |
m_elementMap
Map of elements describing each poolable. |
private boolean |
m_tracing
True if tracing is enabled for the pool. |
Fields inherited from class org.apache.avalon.excalibur.pool.InstrumentedResourceLimitingPool |
---|
DEFAULT_INSTRUMENTABLE_NAME, INSTRUMENT_BLOCKS_NAME, INSTRUMENT_CREATES_NAME, INSTRUMENT_DECOMMISSIONS_NAME, INSTRUMENT_GETS_NAME, INSTRUMENT_PUTS_NAME, INSTRUMENT_READY_SIZE_NAME, INSTRUMENT_SIZE_NAME, m_semaphore |
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable |
---|
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY |
Constructor Summary | |
---|---|
TraceableResourceLimitingPool(org.apache.avalon.excalibur.pool.ObjectFactory factory,
int max,
boolean maxStrict,
boolean blocking,
long blockTimeout,
long trimInterval,
boolean trace)
Creates a new TraceableResourceLimitingPool |
Method Summary | |
---|---|
org.apache.avalon.excalibur.pool.Poolable |
get()
Gets a Poolable from the pool. |
TraceableResourceLimitingPool.State |
getState()
Returns a snapshot of the current state of the pool. |
void |
put(org.apache.avalon.excalibur.pool.Poolable poolable)
Returns a poolable to the pool and notifies any thread blocking. |
protected void |
removePoolable(org.apache.avalon.excalibur.pool.Poolable poolable)
Called when an object is being removed permanently from the pool. |
Methods inherited from class org.apache.avalon.excalibur.pool.InstrumentedResourceLimitingPool |
---|
dispose, getChildInstrumentables, getInstrumentableName, getInstruments, getReadySize, getSize, newPoolable, permanentlyRemovePoolable, setInstrumentableName, trim |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled |
---|
enableLogging |
Field Detail |
---|
private boolean m_tracing
private java.util.Map m_elementMap
Constructor Detail |
---|
public TraceableResourceLimitingPool(org.apache.avalon.excalibur.pool.ObjectFactory factory, int max, boolean maxStrict, boolean blocking, long blockTimeout, long trimInterval, boolean trace)
factory
- The ObjectFactory which will be used to create new Poolables as needed by
the pool.max
- Maximum number of Poolables which can be stored in the pool, 0 implies no limit.maxStrict
- true if the pool should never allow more than max Poolable to be created.
Will cause an exception to be thrown if more than max Poolables are requested and blocking
is false.blocking
- true if the pool should cause a thread calling get() to block when Poolables
are not currently available on the pool.blockTimeout
- The maximum amount of time, in milliseconds, that a call to get() will
block before an exception is thrown. A value of 0 implies an indefinate wait.trimInterval
- The minimum interval with which old unused poolables will be removed
from the pool. A value of 0 will cause the pool to never trim poolables.trace
- True if tracing of gets is enabled for the pool.Method Detail |
---|
public org.apache.avalon.excalibur.pool.Poolable get() throws java.lang.Exception
get
in interface org.apache.avalon.excalibur.pool.Pool
get
in class InstrumentedResourceLimitingPool
java.lang.Exception
- An exception may be thrown as described above or if there is an exception
thrown by the ObjectFactory's newInstance() method.public void put(org.apache.avalon.excalibur.pool.Poolable poolable)
put
in interface org.apache.avalon.excalibur.pool.Pool
put
in class InstrumentedResourceLimitingPool
poolable
- Poolable to return to the pool.protected void removePoolable(org.apache.avalon.excalibur.pool.Poolable poolable)
This method is only called by threads that have m_semaphore locked.
removePoolable
in class InstrumentedResourceLimitingPool
poolable
- Poolable to be completely removed from the pool.public TraceableResourceLimitingPool.State getState()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |