com.ibm.etill.framework.supervisor
Class TimeableTransaction

java.lang.Object
  |
  +--com.ibm.etill.framework.supervisor.TimeableTransaction
All Implemented Interfaces:
Timeable

public final class TimeableTransaction
extends Object
implements Timeable

TimeableTransaction objects queue WorkItem objects to the Framework's service thread queue when the specified expiration time has been reached.

This class implements the Timeable interface which enables cassette objects to be put on the framework work queue. Timeable is an internal interface used by the framework only.

See Also:
CassetteWorkItem, Supervisor.addItemToTimerQueue(com.ibm.etill.framework.supervisor.TimeableTransaction), Supervisor.addItemToServiceQueue(com.ibm.etill.framework.supervisor.WorkItem)

Constructor Summary
TimeableTransaction(WorkItem workItem, long time)
          Constructs a TimeableTransaction object for the specified WorkItem and sets the timer for the specified expiration value.
 
Method Summary
 void timesUp()
          Cassettes should not call this method.
 long timesUpTime()
          Returns the expiration time of this TimeableTransaction.
 WorkItem workItem()
          Returns the WorkItem object to be processed when the expiration time is reached.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeableTransaction

public TimeableTransaction(WorkItem workItem,
                           long time)
Constructs a TimeableTransaction object for the specified WorkItem and sets the timer for the specified expiration value.

Parameters:
workItem - an object that implements the WorkItem interface. Cassettes should always pass a CassetteWorkItem object here to ensure that the appropriate object locks are obtained when the item is eventually processed.
time - a long value that represents the time when this transaction should be processed. The time value must be represented as the number of milliseconds from midnight, January 1, 1970 UTC, when the transaction should be processed.
Method Detail

workItem

public WorkItem workItem()
Returns the WorkItem object to be processed when the expiration time is reached. The Framework calls this method in order to access the WorkItem after the expiration time has been reached.
Specified by:
workItem in interface Timeable
Returns:
WorkItem - the work item to be processed

timesUpTime

public long timesUpTime()
Returns the expiration time of this TimeableTransaction. This method is called by the Framework when the object is added to the timer queue.
Specified by:
timesUpTime in interface Timeable
Returns:
long - the time when this object will be processed. The time is expressed as the number of milliseconds from midnight, January 1, 1970 UTC.
See Also:
Supervisor.addItemToTimerQueue(com.ibm.etill.framework.supervisor.TimeableTransaction)

timesUp

public void timesUp()
Cassettes should not call this method.

Adds the WorkItem to the Framework's service thread queue when the expiration time has been reached. This method is called by the Framework's timer thread at the appropriate time.

Specified by:
timesUp in interface Timeable