|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.util.pool.ResourceWrapper
public class ResourceWrapper
Container holds infos about a resource.
All ResourceWrapper are handled in a pool, the 'PoolManager' class.
PoolManager
Field Summary | |
---|---|
private static java.lang.String |
BUSY_TO_IDLE_TIMEOUT
Constant to mark busy to idle timer events |
private long |
busyToIdleTimeout
Max live span of instance since lastAccess in milliseconds |
private java.lang.Object |
BUSYTOIDLETIMEOUT_MONITOR
Synchronization helper |
private Timestamp |
busyToIdleTimeoutHandle
busyToIdleTimeout handle |
private long |
creationTime
Time in milliseconds since January 1, 1970 UTC. |
private static java.lang.String |
IDLE_TO_ERASE_TIMEOUT
Constant to mark idle to erase timer events |
private long |
idleToEraseTimeout
Max live span until 'idle' to 'erase' transition |
private Timestamp |
idleToEraseTimeoutHandle
idleToEraseTimeout handle |
private java.lang.String |
instanceId
Unique identifier |
private java.lang.String |
ME
Nice, unique name for logging output |
private PoolManager |
poolManager
My manager |
private java.lang.Object |
resource
The resource itself (not interpreted in this context). |
Constructor Summary | |
---|---|
ResourceWrapper(PoolManager poolManager)
Create a new wrapper for a resource with infinite lifespan. |
|
ResourceWrapper(PoolManager poolManager,
java.lang.String instanceId,
java.lang.Object resource,
long busyToIdleTimeout,
long idleToEraseTimeout)
Create a new wrapper for a user supplied resource. |
Method Summary | |
---|---|
long |
busyElapsed()
How long am i running in busy mode. |
void |
destroy()
Cleanup, reset timer and destroy id. |
long |
getBusyToIdleTimeout()
Access the overall busy timeout span of this resource. |
long |
getCreationTime()
Access the construction date of this ResourceWrapper. |
long |
getIdleToEraseTimeout()
Access the overall idle timeout span of this resource. |
java.lang.String |
getInstanceId()
Access the unique resource ID. |
java.lang.Object |
getResource()
Access the resource object. |
(package private) void |
init(java.lang.String instanceId,
java.lang.Object resource,
long busyToIdleTimeout,
long idleToEraseTimeout)
Set resource attributes. |
boolean |
isBusyExpired()
Is the resource life span expired? |
private void |
setBusyToIdle(long val)
Set timeout and initialize timer. |
private void |
setIdleToErase(long val)
Set timeout and initialize timer. |
(package private) void |
setResource(java.lang.Object resource)
Set your resource object. |
long |
spanOfTimeToErase()
How long to my death. |
long |
spanOfTimeToIdle()
How long until i swap from busy to idle. |
private void |
startBusyToIdleTimeout()
Start the timeout. |
private void |
startIdleToEraseTimeout()
Start the idle to erase timeout. |
private void |
stopBusyToIdleTimeout()
Stop the timeout. |
private void |
stopIdleToEraseTimeout()
Stop the idle to erase timeout. |
void |
timeout(java.lang.Object obj)
A timeout occurred. |
(package private) void |
toBusy()
Entering 'busy' state. |
(package private) void |
toIdle()
Entering 'idle' state. |
void |
touchBusy()
Restart count down in busy mode. |
java.lang.String |
toXml()
Dump state of this object into a XML ASCII string. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String ME
private java.lang.String instanceId
private java.lang.Object resource
private long creationTime
private static final java.lang.String BUSY_TO_IDLE_TIMEOUT
private static final java.lang.String IDLE_TO_ERASE_TIMEOUT
private long busyToIdleTimeout
private Timestamp busyToIdleTimeoutHandle
private final java.lang.Object BUSYTOIDLETIMEOUT_MONITOR
private long idleToEraseTimeout
private Timestamp idleToEraseTimeoutHandle
private PoolManager poolManager
Constructor Detail |
---|
ResourceWrapper(PoolManager poolManager, java.lang.String instanceId, java.lang.Object resource, long busyToIdleTimeout, long idleToEraseTimeout)
poolManager
- A reference on my managerinstanceId
- The unique IDresource
- Your resourcebusyToIdleTimeout
- The max. 'busy' life span for this resourceidleToEraseTimeout
- The max. 'idle' life span for this resourceResourceWrapper(PoolManager poolManager)
poolManager
- A reference on my managerMethod Detail |
---|
void init(java.lang.String instanceId, java.lang.Object resource, long busyToIdleTimeout, long idleToEraseTimeout)
instanceId
- The unique identifierresource
- Your resourcebusyToIdleTimeout
- The max. busy life span.idleToEraseTimeout
- The max. 'idle' life span for this resourcevoid toBusy()
void toIdle()
private void setBusyToIdle(long val)
private void startBusyToIdleTimeout()
private void stopBusyToIdleTimeout()
private void setIdleToErase(long val)
private void startIdleToEraseTimeout()
private void stopIdleToEraseTimeout()
public void timeout(java.lang.Object obj)
timeout
in interface I_Timeout
The
- timeout type, BUSY_TO_IDLE_TIMEOUT or IDLE_TO_ERASE_TIMEOUTpublic boolean isBusyExpired()
public long busyElapsed()
public long spanOfTimeToErase()
public long spanOfTimeToIdle()
public void touchBusy()
public java.lang.String getInstanceId()
public java.lang.Object getResource()
void setResource(java.lang.Object resource)
The
- new resourcepublic long getBusyToIdleTimeout()
public long getIdleToEraseTimeout()
public void destroy()
public long getCreationTime()
public final java.lang.String toXml()
public final java.lang.String toXml(java.lang.String extraOffset)
extraOffset
- indenting of tags for nice output
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |