Package com.iizix.txp.impl
Class TXPCoordinatorImpl
java.lang.Object
com.iizix.txp.impl.TXPCoordinatorImpl
- All Implemented Interfaces:
ITXPCoordinator,ITXPMonitor
Basic and crude (for now)
ITXPCoordinator implementation- Author:
- Freggle
Constructor Summary
ConstructorsConstructorDescriptionConstructs aTXPCoordinatorImplinstance with the default policyTXPCoordinatorImpl(ITXPPolicy policy) Constructs aTXPCoordinatorImplinstance with the specified policyMethod Summary
Modifier and TypeMethodDescriptionvoidaddMonitor(ITXPMonitor monitor) Adds the specified TXP monitor.voidcommit(ITXProcess process) Called by the process to signal that the process logic/application requests a commit.Returns the coordinatorCreates a new implementation specificITXProcessinstance and sets itself as coordinator.voidonBeganProcess(ITXProcess process) Called when a process created and associated with he controllervoidonCommitCanceled(ITXProcess process, TXPException reason) Called when the process aborts committing.voidonCommitInitiated(ITXProcess process) Called when a process is called to attempt a commitvoidonMonitorAdded(ITXPMonitor monitor) Called when a monitor is added to the coordinator's monitor chainvoidonMonitorRemoved(ITXPMonitor monitor) Called when a monitor is removed from the coordinator's monitor chainvoidonNodeAssociated(ITXProcess process, ITXPNode node, ITXPNode.State returnedState) Called when a node is associated with a processvoidonNodeCommitFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Called when the policy action is determined for a node that failed to commitvoidonNodeDisassociated(ITXProcess process, ITXPNode node) Called when a node is disassociated from a processvoidonNodeReady(ITXProcess process, ITXPNode node, ITXPNode.State returnedState) Called when a node has finished doing the work neededvoidonNodeReadyFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Called when the policy action is determined for a node that failed processingvoidonNodeRollbackFailedPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Called when the policy action is determined for a node that failed to rollbackvoidonNodeTimeoutSignaled(ITXProcess process, ITXPNode node) Called when a node indicates it timed out waiting on the process.voidonNodeTimeoutSignaledPolicyAction(ITXProcess process, ITXPNode node, ITXPPolicy.Action action) Called when the policy action is determined for a node that timed out waiting for completion.voidonProcessCompleted(ITXProcess process) Called when a process has been completed (either committed or rolled back)voidonProcessCreated(ITXProcess process) Called when the process is created.voidonProcessTimeoutSignaled(ITXProcess process) Called when a process indicates it timed out waiting on the nodesvoidonProcessTimeoutSignaledPolicyAction(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.voidonRollbackCanceled(ITXProcess process, TXPException reason) Called when the process aborts rolling back.voidonRollbackInitiated(ITXProcess process) Called when a process is called to attempt a rollbackvoidready(ITXProcess process, ITXPNode node, ITXPNode.State nodeState) Called by the process to signal that a node is ready for completion.voidremoveMonitor(ITXPMonitor monitor) Removes the specified TXP monitor.voidrollback(ITXProcess process) Called by the process to signal that the process logic/application requests a rollback.voidsetLogger(ITXPLogger logger) Sets the logger.
Constructor Details
TXPCoordinatorImpl
public TXPCoordinatorImpl()Constructs aTXPCoordinatorImplinstance with the default policyTXPCoordinatorImpl
Constructs aTXPCoordinatorImplinstance with the specified policy- Parameters:
policy- the policy to use
Method Details
setLogger
Sets the logger.- Parameters:
logger- The new logger instance.
newProcess
Description copied from interface:ITXPCoordinatorCreates a new implementation specificITXProcessinstance and sets itself as coordinator.- Specified by:
newProcessin interfaceITXPCoordinator- Returns:
- an
ITXProcessinstance
ready
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 interfaceITXPCoordinator- Parameters:
process- the processnode- the nodenodeState- the current state of the node
commit
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 interfaceITXPCoordinator- Parameters:
process- the process- Throws:
TXPException- a coordinator and policy dependent exception (today 1 of 3, more details later)
rollback
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 interfaceITXPCoordinator- Parameters:
process- the process- Throws:
TXPException- a coordinator and policy dependent exception (today 1 of 3, more details later)
addMonitor
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 interfaceITXPCoordinator- Parameters:
monitor- the monitor
removeMonitor
Description copied from interface:ITXPCoordinatorRemoves the specified TXP monitor.- Specified by:
removeMonitorin interfaceITXPCoordinator- Parameters:
monitor- The monitor.
getCoordinator
Description copied from interface:ITXPMonitorReturns the coordinator- Specified by:
getCoordinatorin interfaceITXPMonitor- Returns:
- the coordinator
onMonitorAdded
Description copied from interface:ITXPMonitorCalled when a monitor is added to the coordinator's monitor chain- Specified by:
onMonitorAddedin interfaceITXPMonitor- Parameters:
monitor- the monitor that got added
onMonitorRemoved
Description copied from interface:ITXPMonitorCalled when a monitor is removed from the coordinator's monitor chain- Specified by:
onMonitorRemovedin interfaceITXPMonitor- Parameters:
monitor- the monitor that got removed
onBeganProcess
Description copied from interface:ITXPMonitorCalled when a process created and associated with he controller- Specified by:
onBeganProcessin interfaceITXPMonitor- Parameters:
process- the process
onNodeAssociated
Description copied from interface:ITXPMonitorCalled when a node is associated with a process- Specified by:
onNodeAssociatedin interfaceITXPMonitor- Parameters:
process- the processnode- the nodereturnedState- the returned node state
onNodeDisassociated
Description copied from interface:ITXPMonitorCalled when a node is disassociated from a process- Specified by:
onNodeDisassociatedin interfaceITXPMonitor- Parameters:
process- the processnode- the node
onNodeReady
Description copied from interface:ITXPMonitorCalled when a node has finished doing the work needed- Specified by:
onNodeReadyin interfaceITXPMonitor- Parameters:
process- the processnode- the nodereturnedState- the node state after attempting to do the work
onNodeTimeoutSignaled
Description copied from interface:ITXPMonitorCalled when a node indicates it timed out waiting on the process.- Specified by:
onNodeTimeoutSignaledin interfaceITXPMonitor- Parameters:
process- the processnode- the node
onProcessTimeoutSignaled
Description copied from interface:ITXPMonitorCalled when a process indicates it timed out waiting on the nodes- Specified by:
onProcessTimeoutSignaledin interfaceITXPMonitor- Parameters:
process- the process
onCommitInitiated
Description copied from interface:ITXPMonitorCalled when a process is called to attempt a commit- Specified by:
onCommitInitiatedin interfaceITXPMonitor- Parameters:
process- the process
onCommitCanceled
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 interfaceITXPMonitor- Parameters:
process- the processreason- the exception thrown by the commit
onRollbackInitiated
Description copied from interface:ITXPMonitorCalled when a process is called to attempt a rollback- Specified by:
onRollbackInitiatedin interfaceITXPMonitor- Parameters:
process- the process
onRollbackCanceled
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 interfaceITXPMonitor- Parameters:
process- the processreason- 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 interfaceITXPMonitor- Parameters:
process- the processnode- the nodeaction- 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 interfaceITXPMonitor- Parameters:
process- the processnode- the nodeaction- 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 interfaceITXPMonitor- Parameters:
process- the processnode- the nodeaction- 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 interfaceITXPMonitor- Parameters:
process- the processnode- the nodeaction- the action
onProcessTimeoutSignaledPolicyAction
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 interfaceITXPMonitor- Parameters:
process- the processaction- the action
onProcessCreated
Description copied from interface:ITXPMonitorCalled when the process is created.- Specified by:
onProcessCreatedin interfaceITXPMonitor- Parameters:
process- The process.
onProcessCompleted
Description copied from interface:ITXPMonitorCalled when a process has been completed (either committed or rolled back)- Specified by:
onProcessCompletedin interfaceITXPMonitor- Parameters:
process- The process.