|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.pool.Waiter
public class Waiter
Object created by WaiterFactory
. Maintains active / valid state,
last passivated and idle times. Waits with configurable latency when
doWait()
method is called.
This class is *not* threadsafe.
Constructor Summary | |
---|---|
Waiter(boolean active,
boolean valid,
long latency)
|
Method Summary | |
---|---|
void |
doWait()
Wait for getLatency() ms. |
long |
getLastIdleTimeMs()
Returns the last idle time for this instance in ms. |
long |
getLastPassivated()
Returns the system time of this instance's last passivation. |
long |
getLatency()
|
boolean |
isActive()
Whether or not the instance is active. |
boolean |
isValid()
|
void |
setActive(boolean active)
Sets the active state and updates lastIdleTime
or lastPassivated as appropriate. |
void |
setLatency(long latency)
|
void |
setValid(boolean valid)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Waiter(boolean active, boolean valid, long latency)
Method Detail |
---|
public void doWait()
getLatency()
ms.
public boolean isActive()
public void setActive(boolean active)
Sets the active state and updates lastIdleTime
or lastPassivated
as appropriate.
If the active state is changing from inactive to active, lastIdleTime is updated with the current time minus lastPassivated. If the state is changing from active to inactive, lastPassivated is updated with the current time.
WaiterFactory.activateObject(Object)
and
WaiterFactory.passivateObject(Object)
invoke this method on their
actual parameter, passing true
and false
,
respectively.
active
- new active statepublic long getLatency()
public void setLatency(long latency)
public boolean isValid()
public void setValid(boolean valid)
public long getLastPassivated()
Returns the system time of this instance's last passivation.
When an instance is created, this field is initialized to the system time.
public long getLastIdleTimeMs()
Returns the last idle time for this instance in ms.
When an instance is created, and each subsequent time it is passivated,
the lastPassivated
property is updated with the
current time. When the next activation occurs, lastIdleTime
is
updated with the elapsed time since passivation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |