xmlBlaster 2.2.0 client API

org.xmlBlaster.util.pool
Class ResourceWrapper

java.lang.Object
  extended by org.xmlBlaster.util.pool.ResourceWrapper
All Implemented Interfaces:
I_Timeout

public class ResourceWrapper
extends java.lang.Object
implements I_Timeout

Container holds infos about a resource.

All ResourceWrapper are handled in a pool, the 'PoolManager' class.

Author:
ruff@swand.lake.de
See Also:
PoolManager

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.
 boolean isBusyExpired()
          Is the resource life span expired?
 long spanOfTimeToErase()
          How long to my death.
 long spanOfTimeToIdle()
          How long until i swap from busy to idle.
 void timeout(java.lang.Object obj)
          A timeout occurred.
 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
 

Method Detail

timeout

public void timeout(java.lang.Object obj)
A timeout occurred.

This method is a callback through interface I_Timeout.

Specified by:
timeout in interface I_Timeout
Parameters:
The - timeout type, BUSY_TO_IDLE_TIMEOUT or IDLE_TO_ERASE_TIMEOUT

isBusyExpired

public boolean isBusyExpired()
Is the resource life span expired?

Returns:
true/false

busyElapsed

public long busyElapsed()
How long am i running in busy mode.

Returns:
Milliseconds since creation or -1 if not known

spanOfTimeToErase

public long spanOfTimeToErase()
How long to my death.

Returns:
Milliseconds to idleToEraseTimeout
0 for infinite idle life

spanOfTimeToIdle

public long spanOfTimeToIdle()
How long until i swap from busy to idle.

Returns:
Milliseconds to busyToIdleTimeout
0 for infinite life
-1 if busyToIdleTimeout occurred already

touchBusy

public void touchBusy()
Restart count down in busy mode.


getInstanceId

public java.lang.String getInstanceId()
Access the unique resource ID.

Returns:
The unique ID of this resource

getResource

public java.lang.Object getResource()
Access the resource object.

Returns:
Your resource object

getBusyToIdleTimeout

public long getBusyToIdleTimeout()
Access the overall busy timeout span of this resource.

Returns:
timeout span in milliseconds

getIdleToEraseTimeout

public long getIdleToEraseTimeout()
Access the overall idle timeout span of this resource.

Returns:
timeout span in milliseconds

destroy

public void destroy()
Cleanup, reset timer and destroy id.


getCreationTime

public long getCreationTime()
Access the construction date of this ResourceWrapper.

Returns:
Time in milliseconds since midnight, January 1, 1970 UTC

toXml

public final java.lang.String toXml()
Dump state of this object into a XML ASCII string.

Returns:
internal state of this ResourceWrapper as a XML ASCII string

toXml

public final java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of this ResourceWrapper as a XML ASCII string

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.