Package com.iizix.txp.impl
Class TXPCoordinatorImpl
- java.lang.Object
- com.iizix.txp.impl.TXPCoordinatorImpl
 
- All Implemented Interfaces:
- ITXPCoordinator,- ITXPMonitor
 - public class TXPCoordinatorImpl extends java.lang.Object implements ITXPCoordinator Basic and crude (for now)- ITXPCoordinatorimplementation- Author:
- Freggle
 
- Constructor Summary- Constructors - Constructor - Description - TXPCoordinatorImpl()Constructs a- TXPCoordinatorImplinstance with the default policy- TXPCoordinatorImpl(ITXPPolicy policy)Constructs a- TXPCoordinatorImplinstance with the specified policy
 - Method Summary- All Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - void- addMonitor(ITXPMonitor monitor)Adds the specified TXP monitor.- void- commit(ITXProcess process)Called by the process to signal that the process logic/application requests a commit.- ITXPCoordinator- getCoordinator()Returns the coordinator- ITXProcess- newProcess()Creates a new implementation specific- ITXProcessinstance and sets itself as coordinator.- void- onBeganProcess(ITXProcess process)Called when a process created and associated with he controller- void- onCommitCanceled(ITXProcess process, TXPException reason)Called when the process aborts committing.- void- onCommitInitiated(ITXProcess process)Called when a process is called to attempt a commit- void- onMonitorAdded(ITXPMonitor monitor)Called when a monitor is added to the coordinator's monitor chain- void- onMonitorRemoved(ITXPMonitor monitor)Called when a monitor is removed from the coordinator's monitor chain- void- onNodeAssociated(ITXProcess process, ITXPNode node, ITXPNode.State returnedState)Called when a node is associated with a process- void- onNodeCommitFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action)Called when the policy action is determined for a node that failed to commit- void- onNodeDisassociated(ITXProcess process, ITXPNode node)Called when a node is disassociated from a process- void- onNodeReady(ITXProcess process, ITXPNode node, ITXPNode.State returnedState)Called when a node has finished doing the work needed- void- onNodeReadyFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action)Called when the policy action is determined for a node that failed processing- void- onNodeRollbackFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action)Called when the policy action is determined for a node that failed to rollback- void- onNodeTimeoutSignaled(ITXProcess process, ITXPNode node)Called when a node indicates it timed out waiting on the process.- void- onNodeTimeoutSignaledPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action)Called when the policy action is determined for a node that timed out waiting for completion.- void- onProcessCompleted(ITXProcess process)Called when a process has been completed (either committed or rolled back)- void- onProcessCreated(ITXProcess process)Called when the process is created.- void- onProcessTimeoutSignaled(ITXProcess process)Called when a process indicates it timed out waiting on the nodes- void- onProcessTimeoutSignaledPolicyAction(ITXProcess process, ITXPPolicy.Action action)Called when the policy action is determined for a process that timed out waiting for the nodes to do the work.- void- onRollbackCanceled(ITXProcess process, TXPException reason)Called when the process aborts rolling back.- void- onRollbackInitiated(ITXProcess process)Called when a process is called to attempt a rollback- void- ready(ITXProcess process, ITXPNode node, ITXPNode.State nodeState)Called by the process to signal that a node is ready for completion.- void- removeMonitor(ITXPMonitor monitor)Removes the specified TXP monitor.- void- rollback(ITXProcess process)Called by the process to signal that the process logic/application requests a rollback.- void- setLogger(ITXPLogger logger)Sets the logger.
 
- Constructor Detail- TXPCoordinatorImpl- public TXPCoordinatorImpl() Constructs a- TXPCoordinatorImplinstance with the default policy
 - TXPCoordinatorImpl- public TXPCoordinatorImpl(ITXPPolicy policy) Constructs a- TXPCoordinatorImplinstance with the specified policy- Parameters:
- policy- the policy to use
 
 
 - Method Detail- setLogger- public void setLogger(ITXPLogger logger) Sets the logger.- Parameters:
- logger- The new logger instance.
 
 - newProcess- public ITXProcess newProcess() Description copied from interface:- ITXPCoordinatorCreates a new implementation specific- ITXProcessinstance and sets itself as coordinator.- Specified by:
- newProcessin interface- ITXPCoordinator
- Returns:
- an ITXProcessinstance
 
 - ready- public void ready(ITXProcess process, ITXPNode node, ITXPNode.State nodeState) Description copied from interface:- ITXPCoordinatorCalled by the process to signal that a node is ready for completion. Typically the coordinator handles error states that may occur using a policy.- Specified by:
- readyin interface- ITXPCoordinator
- Parameters:
- process- the process
- node- the node
- nodeState- the current state of the node
 
 - commit- public void commit(ITXProcess process) throws TXPException Description copied from interface:- ITXPCoordinatorCalled by the process to signal that the process logic/application requests a commit. Typically the coordinator coordinates the commit and handles error states that may occur using a policy.- Specified by:
- commitin interface- ITXPCoordinator
- Parameters:
- process- the process
- Throws:
- TXPException- a coordinator and policy dependent exception (today 1 of 3, more details later)
 
 - rollback- public void rollback(ITXProcess process) throws TXPException Description copied from interface:- ITXPCoordinatorCalled by the process to signal that the process logic/application requests a rollback. Typically the coordinator coordinates the commit and handles error states that may occur using a policy.- Specified by:
- rollbackin interface- ITXPCoordinator
- Parameters:
- process- the process
- Throws:
- TXPException- a coordinator and policy dependent exception (today 1 of 3, more details later)
 
 - addMonitor- public void addMonitor(ITXPMonitor monitor) Description copied from interface:- ITXPCoordinatorAdds the specified TXP monitor. Monitors can be used for logging and monitoring processes under this coordinator's control.- Specified by:
- addMonitorin interface- ITXPCoordinator
- Parameters:
- monitor- the monitor
 
 - removeMonitor- public void removeMonitor(ITXPMonitor monitor) Description copied from interface:- ITXPCoordinatorRemoves the specified TXP monitor.- Specified by:
- removeMonitorin interface- ITXPCoordinator
- Parameters:
- monitor- The monitor.
 
 - getCoordinator- public ITXPCoordinator getCoordinator() Description copied from interface:- ITXPMonitorReturns the coordinator- Specified by:
- getCoordinatorin interface- ITXPMonitor
- Returns:
- the coordinator
 
 - onMonitorAdded- public void onMonitorAdded(ITXPMonitor monitor) Description copied from interface:- ITXPMonitorCalled when a monitor is added to the coordinator's monitor chain- Specified by:
- onMonitorAddedin interface- ITXPMonitor
- Parameters:
- monitor- the monitor that got added
 
 - onMonitorRemoved- public void onMonitorRemoved(ITXPMonitor monitor) Description copied from interface:- ITXPMonitorCalled when a monitor is removed from the coordinator's monitor chain- Specified by:
- onMonitorRemovedin interface- ITXPMonitor
- Parameters:
- monitor- the monitor that got removed
 
 - onBeganProcess- public void onBeganProcess(ITXProcess process) Description copied from interface:- ITXPMonitorCalled when a process created and associated with he controller- Specified by:
- onBeganProcessin interface- ITXPMonitor
- Parameters:
- process- the process
 
 - onNodeAssociated- public void onNodeAssociated(ITXProcess process, ITXPNode node, ITXPNode.State returnedState) Description copied from interface:- ITXPMonitorCalled when a node is associated with a process- Specified by:
- onNodeAssociatedin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
- returnedState- the returned node state
 
 - onNodeDisassociated- public void onNodeDisassociated(ITXProcess process, ITXPNode node) Description copied from interface:- ITXPMonitorCalled when a node is disassociated from a process- Specified by:
- onNodeDisassociatedin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
 
 - onNodeReady- public void onNodeReady(ITXProcess process, ITXPNode node, ITXPNode.State returnedState) Description copied from interface:- ITXPMonitorCalled when a node has finished doing the work needed- Specified by:
- onNodeReadyin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
- returnedState- the node state after attempting to do the work
 
 - onNodeTimeoutSignaled- public void onNodeTimeoutSignaled(ITXProcess process, ITXPNode node) Description copied from interface:- ITXPMonitorCalled when a node indicates it timed out waiting on the process.- Specified by:
- onNodeTimeoutSignaledin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
 
 - onProcessTimeoutSignaled- public void onProcessTimeoutSignaled(ITXProcess process) Description copied from interface:- ITXPMonitorCalled when a process indicates it timed out waiting on the nodes- Specified by:
- onProcessTimeoutSignaledin interface- ITXPMonitor
- Parameters:
- process- the process
 
 - onCommitInitiated- public void onCommitInitiated(ITXProcess process) Description copied from interface:- ITXPMonitorCalled when a process is called to attempt a commit- Specified by:
- onCommitInitiatedin interface- ITXPMonitor
- Parameters:
- process- the process
 
 - onCommitCanceled- public void onCommitCanceled(ITXProcess process, TXPException reason) Description copied from interface:- ITXPMonitorCalled when the process aborts committing. This can happen if a rollback is requested or one or more nodes have not yet finished processing.- Specified by:
- onCommitCanceledin interface- ITXPMonitor
- Parameters:
- process- the process
- reason- the exception thrown by the commit
 
 - onRollbackInitiated- public void onRollbackInitiated(ITXProcess process) Description copied from interface:- ITXPMonitorCalled when a process is called to attempt a rollback- Specified by:
- onRollbackInitiatedin interface- ITXPMonitor
- Parameters:
- process- the process
 
 - onRollbackCanceled- public void onRollbackCanceled(ITXProcess process, TXPException reason) Description copied from interface:- ITXPMonitorCalled when the process aborts rolling back. This can happen if one or more nodes have not yet finished processing.- Specified by:
- onRollbackCanceledin interface- ITXPMonitor
- Parameters:
- process- the process
- reason- the exception thrown by the rollback
 
 - onNodeReadyFailedPolicyAction- public void onNodeReadyFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Description copied from interface:- ITXPMonitorCalled when the policy action is determined for a node that failed processing- Specified by:
- onNodeReadyFailedPolicyActionin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
- action- the policy action
 
 - onNodeCommitFailedPolicyAction- public void onNodeCommitFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Description copied from interface:- ITXPMonitorCalled when the policy action is determined for a node that failed to commit- Specified by:
- onNodeCommitFailedPolicyActionin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
- action- the action
 
 - onNodeRollbackFailedPolicyAction- public void onNodeRollbackFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Description copied from interface:- ITXPMonitorCalled when the policy action is determined for a node that failed to rollback- Specified by:
- onNodeRollbackFailedPolicyActionin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
- action- the action
 
 - onNodeTimeoutSignaledPolicyAction- public void onNodeTimeoutSignaledPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Description copied from interface:- ITXPMonitorCalled when the policy action is determined for a node that timed out waiting for completion.- Specified by:
- onNodeTimeoutSignaledPolicyActionin interface- ITXPMonitor
- Parameters:
- process- the process
- node- the node
- action- the action
 
 - onProcessTimeoutSignaledPolicyAction- public void onProcessTimeoutSignaledPolicyAction(ITXProcess process, ITXPPolicy.Action action) Description copied from interface:- ITXPMonitorCalled when the policy action is determined for a process that timed out waiting for the nodes to do the work.- Specified by:
- onProcessTimeoutSignaledPolicyActionin interface- ITXPMonitor
- Parameters:
- process- the process
- action- the action
 
 - onProcessCreated- public void onProcessCreated(ITXProcess process) Description copied from interface:- ITXPMonitorCalled when the process is created.- Specified by:
- onProcessCreatedin interface- ITXPMonitor
- Parameters:
- process- The process.
 
 - onProcessCompleted- public void onProcessCompleted(ITXProcess process) Description copied from interface:- ITXPMonitorCalled when a process has been completed (either committed or rolled back)- Specified by:
- onProcessCompletedin interface- ITXPMonitor
- Parameters:
- process- The process.