Package com.iizix.txp.impl
Class AbstractTXPNode
java.lang.Object
com.iizix.txp.impl.AbstractTXPNode
- All Implemented Interfaces:
- ITimeoutListener,- ITXPNode
- Direct Known Subclasses:
- AbstractActionActorTXPNode
- Author:
- Freggle
- Nested Class Summary- Nested classes/interfaces inherited from interface com.iizix.txp.ITXPNode- ITXPNode.State
- Field SummaryFieldsModifier and TypeFieldDescription- protected boolean- protected boolean- protected boolean- protected ITXPidThe Pid- protected ITXProcessThe process this node is associated with- protected ITXPNode.StateThe current state of the node- protected longThe timeout value for this node (default indefinite)- protected ITimeoutTask- protected ITXPNodeLogger
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- protected void- protected void- getPid()Gets the pid of this node.- protected ITXProcessGets the process this node is associated with.- getState()Gets the current state of the node.- longGets the time in milliseconds this node will wait for a commit() or rollback() call after it is ready.- booleanCheck if processTimeout has been called- booleanCheck if timeout has been called- protected boolean- booleanAsks if the node is idempotent.- protected ITXPNodeLogger- log()- voidCalled when timeout is reached.- void- processTimeout- (ITXProcess process) Called by a process to indicate it timed out waiting for all nodes to complete the work.- protected void- ready()- recover- (ITXProcess process) This method instructs an node to recover a process after some sort of system failure.- retry- (ITXProcess process) Instructs the node to retry the work.- void- setTimeout- (long t) - void- timeout- (ITXProcess process) Called by a process to indicate it timed out waiting for this node.- undo- (ITXProcess process) Instructs the node to undo the committed work.
- Field Details- pidThe Pid
- processThe process this node is associated with
- txplog
- stateThe current state of the node
- timeoutprotected long timeoutThe timeout value for this node (default indefinite)
- timeoutTask
- hasTimedOutWaitingprotected volatile boolean hasTimedOutWaiting
- hasTimedOutprotected volatile boolean hasTimedOut
- hasProcessTimedOutprotected volatile boolean hasProcessTimedOut
 
- Constructor Details- AbstractTXPNodepublic AbstractTXPNode()
 
- Method Details- getPidDescription copied from interface:- ITXPNodeGets the pid of this node.
- isIdempotentpublic boolean isIdempotent()Description copied from interface:- ITXPNodeAsks if the node is idempotent. Idempotent means f(f(x)) = f(x). For instance: if the node turns on a light, turning it on again has the same result: the light is on.- Specified by:
- isIdempotentin interface- ITXPNode
- Returns:
- true if this node is idempotent, false if not
 
- getTimeoutpublic long getTimeout()Description copied from interface:- ITXPNodeGets the time in milliseconds this node will wait for a commit() or rollback() call after it is ready.- Specified by:
- getTimeoutin interface- ITXPNode
- Returns:
- the timeout in milliseconds
 
- setTimeoutpublic void setTimeout- (long t) 
- retryDescription copied from interface:- ITXPNodeInstructs the node to retry the work. The node should set and respond with either- ITXPNode.State.OK,- ITXPNode.State.FAILEDor- ITXPNode.State.UNABLEdepending on its state.
- undoDescription copied from interface:- ITXPNodeInstructs the node to undo the committed work. The node should set and respond with either- ITXPNode.State.OK,- ITXPNode.State.FAILEDor- ITXPNode.State.UNABLEdepending on its state. This is of course the 'crux'. It is the implementation that may or may not be able to undo something. For instance. if the node is a JDBC transaction it may know how to perform a compensating transaction; or not.
- recoverDescription copied from interface:- ITXPNodeThis method instructs an node to recover a process after some sort of system failure. In effect this means restoring the state of the ITXPNode to the last known state with regards to the specified process. The node should set and respond with either- ITXPNode.State.OK,- ITXPNode.State.FAILEDor- ITXPNode.State.UNABLEdepending on its state. To be able to do this the node needs to log its state durably and use the Processes Pid as a key.
- getStateGets the current state of the node.
- timeoutDescription copied from interface:- ITXPNodeCalled by a process to indicate it timed out waiting for this node. The node should abandon the work and wait for rollback or return READ_ONLY if it can.
- processTimeoutDescription copied from interface:- ITXPNodeCalled by a process to indicate it timed out waiting for all nodes to complete the work. The node should abandon the work if it can and wait for rollback or return READ_ONLY if it can.- Specified by:
- processTimeoutin interface- ITXPNode
- Parameters:
- process- the process that timed out
 
- onTimeoutpublic void onTimeout()Description copied from interface:- ITimeoutListenerCalled when timeout is reached.- Specified by:
- onTimeoutin interface- ITimeoutListener
 
- hasTimedOutpublic boolean hasTimedOut()Description copied from interface:- ITXPNodeCheck if timeout has been called- Specified by:
- hasTimedOutin interface- ITXPNode
- Returns:
- true if timeout has been called
 
- hasProcessTimedOutpublic boolean hasProcessTimedOut()Description copied from interface:- ITXPNodeCheck if processTimeout has been called- Specified by:
- hasProcessTimedOutin interface- ITXPNode
- Returns:
- try if processTimeout has been called
 
- getProcessGets the process this node is associated with.- Returns:
- Returns the TXProcess instance.
 
- readyprotected void ready()
- hasTimedOutWaitingprotected boolean hasTimedOutWaiting()
- cancelTimeoutprotected void cancelTimeout()
- createLoggerprotected void createLogger()
- log