Package com.iizix.db.prop
Class DatabaseActionTXPNode
java.lang.Object
com.iizix.txp.impl.AbstractTXPNode
com.iizix.txp.impl.AbstractActionActorTXPNode<DatabaseActionActor.Settings>
com.iizix.db.prop.DatabaseActionTXPNode
- All Implemented Interfaces:
IActionActorSettingsReceiver<DatabaseActionActor.Settings>
,ITimeoutListener
,ITXPNode
public abstract class DatabaseActionTXPNode extends AbstractActionActorTXPNode<DatabaseActionActor.Settings>
Database actor implementation for a TXP node.
- 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
ConstructorDescriptionDatabaseActionTXPNode
(VSActionTXProcess actionProcess, DatabaseActionActor.Settings settings, IDBConnectionPool pool) Constructor.Method Summary
Modifier and TypeMethodDescriptionbegin
(ITXProcess process, ITXPid pid) Notifies the node it got associated with a transactional process.commit
(ITXProcess process) Instructs the node to commit the work.protected void
Commits the local transaction after read only work.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.protected Connection
Returns the connection.protected void
Cleans up: releases back the connection to the pool.rollback
(ITXProcess process) Instructs the node to roll back the work.protected void
setState
(ITXPNode.State state) Sets the current state of the node.Methods inherited from class com.iizix.txp.impl.AbstractActionActorTXPNode
assignSettings, cleanUp, createLogger, execute, executeAction, getAction, getActionProcess, getLoggerInfo, getSettings, getVirtualSpace, prepare, prepareAction
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
Constructor Details
DatabaseActionTXPNode
public DatabaseActionTXPNode(VSActionTXProcess actionProcess, DatabaseActionActor.Settings settings, IDBConnectionPool pool) Constructor.- Parameters:
actionProcess
- The action process.settings
- Database action actor settings for transaction.pool
- The Connection pool.
Method Details
begin
Description copied from interface:ITXPNode
Notifies the node it got associated with a transactional process. The node should set up its local transaction context and set and respond with eitherITXPNode.State.WORKING
orITXPNode.State.FAILED
depending on its state.- Parameters:
process
- the processpid
- the pid for this node of the process- Returns:
- the state of the node
getConnection
Returns the connection.- Returns:
- The JDBC connection.
forget
Notifies the node it got disassociated from the process ie it can abort, rollback (if needed) and forget about the process.- Specified by:
forget
in interfaceITXPNode
- Overrides:
forget
in classAbstractActionActorTXPNode<DatabaseActionActor.Settings>
- Parameters:
process
- The process.
commit
Description copied from interface:ITXPNode
Instructs the node to commit the work. The node should set and respond with eitherITXPNode.State.COMPLETED
orITXPNode.State.FAILED
depending on its state. If a commit failed the node is expected to have rolled back the work.- Parameters:
process
- the process- Returns:
- the state of the node
rollback
Description copied from interface:ITXPNode
Instructs the node to roll back the work. The node should set and respond with eitherITXPNode.State.COMPLETED
orITXPNode.State.FAILED
depending on its state. NOTE if the node failed its work it is already rolled back and will returnITXPNode.State.COMPLETED
but remain in state.ITXPNode.State.FAILED
- Parameters:
process
- the process- Returns:
- the state of the node
setState
Sets the current state of the node. If the specified state is READ_ONLY the local transaction is committed immediately. If the state is FAILED the local transaction is immediately rolled back.- Overrides:
setState
in classAbstractActionActorTXPNode<DatabaseActionActor.Settings>
- Parameters:
state
- The state to set.
commitReadOnly
protected void commitReadOnly()Commits the local transaction after read only work. The context is released after commit.onCleanup
protected void onCleanup()Cleans up: releases back the connection to the pool.- Overrides:
onCleanup
in classAbstractActionActorTXPNode<DatabaseActionActor.Settings>