Class AbstractJavaActionActor
java.lang.Object
com.iizix.txp.impl.AbstractTXPNode
com.iizix.txp.impl.AbstractActionActorTXPNode<JavaActionActorBase.Settings>
com.iizix.actionactor.AbstractJavaActionActor
- All Implemented Interfaces:
IActionActorSettingsReceiver<JavaActionActorBase.Settings>, IJavaActionActor, ITimeoutListener, ITXPNode
- Direct Known Subclasses:
TestJavaActionActor
public abstract class AbstractJavaActionActor extends AbstractActionActorTXPNode<JavaActionActorBase.Settings> implements IJavaActionActor
This minimal class implements the Java Action Actor Interface Interface
IJavaActionActor required to handle execution of a VirtualSpace action in conjunction with the TXP engine.- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface ITXPNode
ITXPNode.StateField Summary
Fields inherited from class AbstractTXPNode
hasProcessTimedOut, hasTimedOut, hasTimedOutWaiting, pid, process, state, timeout, timeoutTask, txplogConstructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionfinal ITXPNode.Statebegin(ITXProcess process, ITXPid pid) Notifies the node it got associated with a transactional process.commit(ITXProcess process) Instructs the node to commit the work.voidexecute()Method called to do the serialized work of the action actor.final voidforget(ITXProcess process) Notifies the node it got disassociated from the process ie it can abort, rollback (if needed) and forget about the process.abstract voidonAction()Performs the action as a part of a commit operation.protected voidonBegin()Notifies the node it got associated with a transactional process.protected voidonCommit()Instructs the node to commit the work.protected voidonForget()Notifies the node it got disassociated from the process i.e.protected voidAction actor specific action needed for preparation.protected voidInstructs the node to roll back the work.protected final voidprepare()Action actor specific action needed for preparation.rollback(ITXProcess process) Instructs the node to roll back the work.Methods inherited from class AbstractActionActorTXPNode
assignSettings, cleanUp, createLogger, executeAction, getAction, getActionProcess, getLoggerInfo, getSettings, getVirtualSpace, onCleanup, prepareAction, setStateMethods inherited from class AbstractTXPNode
cancelTimeout, getPid, getProcess, getState, getTimeout, hasProcessTimedOut, hasTimedOut, hasTimedOutWaiting, isIdempotent, log, onTimeout, processTimeout, ready, recover, retry, setTimeout, timeout, undoMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IActionActorSettingsReceiver
assignSettings, getAction, getActionProcess, getSettings, getVirtualSpaceMethods inherited from interface ITXPNode
getPid, getState, getTimeout, hasProcessTimedOut, hasTimedOut, isIdempotent, processTimeout, recover, retry, timeout, undo
Constructor Details
AbstractJavaActionActor
protected AbstractJavaActionActor()Default constructor.
Method Details
begin
Notifies the node it got associated with a transactional process.prepare
Action actor specific action needed for preparation. This method is called from the prepareAction.This method cannot be overridden. Override the method
to perform custom processing.onPrepare()- Overrides:
preparein classAbstractActionActorTXPNode<JavaActionActorBase.Settings>- Throws:
Exception- For any error in the prepare phase.
execute
Method called to do the serialized work of the action actor. This method is called once all nodes are associated with the TXProcess and each node has processed "begin" successfully.By default, this method calls the
method but can be overridden.onAction()- Specified by:
executein classAbstractActionActorTXPNode<JavaActionActorBase.Settings>- Throws:
Exception- For any error in the execution phase.
forget
Notifies the node it got disassociated from the process ie it can abort, rollback (if needed) and forget about the process.This method cannot be overridden. Override the method
to perform custom processing.onForget()- Specified by:
forgetin interfaceITXPNode- Overrides:
forgetin classAbstractActionActorTXPNode<JavaActionActorBase.Settings>- Parameters:
process- The process.
rollback
Instructs the node to roll back the work. The node should set and respond with eitherITXPNode.State.COMPLETEDorITXPNode.State.FAILEDdepending on its state. NOTE if the node failed its work it is already rolled back and will returnITXPNode.State.COMPLETEDbut remain in stateITXPNode.State.FAILED.This method cannot be overridden. Override the method
to perform custom processing.onRollback()commit
Instructs the node to commit the work. The node should set and respond with eitherITXPNode.State.COMPLETEDorITXPNode.State.FAILEDdepending on its state. If a commit failed the node is expected to have rolled back the work.onBegin
onPrepare
onCommit
onRollback
onForget
Notifies the node it got disassociated from the process i.e. it can abort, rollback (if needed) and forget about the process.A node that handles commit and rollback should override this method and call rollback.
The default is to make sure that
has been called, and if not it gets called.onRollback()- Throws:
Exception- For any kind of error.
onAction
public abstract void onAction()Performs the action as a part of a commit operation.- Specified by:
onActionin interfaceIJavaActionActor