Package com.iizix.actionactor
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- IJavaActionActorrequired 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 com.iizix.txp.ITXPNode- ITXPNode.State
 
 - Field Summary- Fields inherited from class com.iizix.txp.impl.AbstractTXPNode- hasProcessTimedOut, hasTimedOut, hasTimedOutWaiting, pid, process, state, timeout, timeoutTask, txplog
 
 - Constructor Summary- Constructors - Modifier - Constructor - Description - protected- AbstractJavaActionActor()Default constructor.
 - Method Summary- All Methods Instance Methods Abstract Methods Concrete Methods - Modifier and Type - Method - Description - ITXPNode.State- begin(ITXProcess process, ITXPid pid)Notifies the node it got associated with a transactional process.- ITXPNode.State- commit(ITXProcess process)Instructs the node to commit the work.- void- execute()Method called to do the serialized work of the action actor.- void- forget(ITXProcess process)Notifies the node it got disassociated from the process ie it can abort, rollback (if needed) and forget about the process.- abstract void- onAction()Performs the action as a part of a commit operation.- protected void- onBegin()Notifies the node it got associated with a transactional process.- protected void- onCommit()Instructs the node to commit the work.- protected void- onForget()Notifies the node it got disassociated from the process i.e.- protected void- onPrepare()Action actor specific action needed for preparation.- protected void- onRollback()Instructs the node to roll back the work.- protected void- prepare()Action actor specific action needed for preparation.- ITXPNode.State- rollback(ITXProcess process)Instructs the node to roll back the work.- Methods inherited from class com.iizix.txp.impl.AbstractActionActorTXPNode- assignSettings, cleanUp, createLogger, executeAction, getAction, getActionProcess, getLoggerInfo, getSettings, getVirtualSpace, onCleanup, prepareAction, setState
 - Methods inherited from class com.iizix.txp.impl.AbstractTXPNode- cancelTimeout, getPid, getProcess, getState, getTimeout, hasProcessTimedOut, hasTimedOut, hasTimedOutWaiting, isIdempotent, log, onTimeout, processTimeout, ready, recover, retry, setTimeout, timeout, undo
 - Methods inherited from class java.lang.Object- clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - Methods inherited from interface com.iizix.actionactor.IActionActorSettingsReceiver- assignSettings, getAction, getActionProcess, getSettings, getVirtualSpace
 - Methods inherited from interface com.iizix.txp.ITXPNode- getPid, getState, getTimeout, hasProcessTimedOut, hasTimedOut, isIdempotent, processTimeout, recover, retry, timeout, undo
 
 
- Method Detail- begin- public final ITXPNode.State begin(ITXProcess process, ITXPid pid) Notifies the node it got associated with a transactional process.
 - prepare- protected final void prepare() throws java.lang.ExceptionAction actor specific action needed for preparation. This method is called from the prepareAction.- This method cannot be overridden. Override the method - onPrepare()- Overrides:
- preparein class- AbstractActionActorTXPNode<JavaActionActorBase.Settings>
- Throws:
- java.lang.Exception- For any error in the prepare phase.
 
 - execute- public void execute() throws java.lang.ExceptionMethod 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 - onAction()- Specified by:
- executein class- AbstractActionActorTXPNode<JavaActionActorBase.Settings>
- Throws:
- java.lang.Exception- For any error in the execution phase.
 
 - forget- public final void forget(ITXProcess process) 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 - onForget()- Specified by:
- forgetin interface- ITXPNode
- Overrides:
- forgetin class- AbstractActionActorTXPNode<JavaActionActorBase.Settings>
- Parameters:
- process- The process.
 
 - rollback- public ITXPNode.State rollback(ITXProcess process) Instructs the node to roll back the work. The node should set and respond with either- ITXPNode.State.COMPLETEDor- ITXPNode.State.FAILEDdepending on its state. NOTE if the node failed its work it is already rolled back and will return- ITXPNode.State.COMPLETEDbut remain in state- ITXPNode.State.FAILED.- This method cannot be overridden. Override the method - onRollback()
 - commit- public ITXPNode.State commit(ITXProcess process) Instructs the node to commit the work. The node should set and respond with either- ITXPNode.State.COMPLETEDor- ITXPNode.State.FAILEDdepending on its state. If a commit failed the node is expected to have rolled back the work.
 - onBegin- protected void onBegin() throws java.lang.ExceptionNotifies the node it got associated with a transactional process. The node should set up its local transaction context as required.- Override this method to perform specific processing. - Throws:
- java.lang.Exception- For any kind of error.
 
 - onPrepare- protected void onPrepare() throws java.lang.ExceptionAction actor specific action needed for preparation. Called after begin to prepare the operation.- Override this method to perform specific processing. - Throws:
- java.lang.Exception- For any kind of error.
 
 - onCommit- protected void onCommit() throws java.lang.ExceptionInstructs the node to commit the work.- This method can be overridden to process commit. - Throws:
- java.lang.Exception- For any kind of error.
 
 - onRollback- protected void onRollback() throws java.lang.ExceptionInstructs the node to roll back the work.- This method can be overridden to process rollback. - Throws:
- java.lang.Exception- For any kind of error.
 
 - onForget- protected void onForget() throws java.lang.ExceptionNotifies 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 - onRollback()- Throws:
- java.lang.Exception- For any kind of error.
 
 - onAction- public abstract void onAction() Performs the action as a part of a commit operation.- Specified by:
- onActionin interface- IJavaActionActor