public interface ITXPNode
ITXProcess
implementation the node
is associated with and its ITXPCoordinator
implementation.
The process is itself guided by the ITXPCoordinator
. The
coordinator can be seen as enforcing a policy.Modifier and Type | Interface and Description |
---|---|
static class |
ITXPNode.State
State enum for a
ITXPNode . |
Modifier and Type | Method and 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 |
forget(ITXProcess process)
Notifies the node it got disassociated from the process ie it can abort,
rollback (if needed) and forget about the process.
|
ITXPid |
getPid()
Gets the pid of this node.
|
ITXPNode.State |
getState()
Returns the state of the node.
|
long |
getTimeout()
Gets the time in milliseconds this node will wait for a commit() or
rollback() call after it is ready.
|
boolean |
hasProcessTimedOut()
Check if processTimeout has been called
|
boolean |
hasTimedOut()
Check if timeout has been called
|
boolean |
isIdempotent()
Asks if the node is idempotent.
|
void |
processTimeout(ITXProcess process)
Called by a process to indicate it timed out waiting for all nodes to
complete the work.
|
ITXPNode.State |
recover(ITXProcess process)
This method instructs an node to recover a process after some sort of
system failure.
|
ITXPNode.State |
retry(ITXProcess process)
Instructs the node to retry the work.
|
ITXPNode.State |
rollback(ITXProcess process)
Instructs the node to roll back the work.
|
void |
timeout(ITXProcess process)
Called by a process to indicate it timed out waiting for this node.
|
ITXPNode.State |
undo(ITXProcess process)
Instructs the node to undo the committed work.
|
ITXPid getPid()
ITXPNode.State getState()
boolean isIdempotent()
long getTimeout()
ITXPNode.State begin(ITXProcess process, ITXPid pid)
ITXPNode.State.WORKING
or ITXPNode.State.FAILED
depending on its state.process
- the processpid
- the pid for this node of the processvoid forget(ITXProcess process)
process
- the processvoid timeout(ITXProcess process)
process
- the process that timed outvoid processTimeout(ITXProcess process)
process
- the process that timed outboolean hasTimedOut()
boolean hasProcessTimedOut()
ITXPNode.State commit(ITXProcess process)
ITXPNode.State.COMPLETED
or ITXPNode.State.FAILED
depending on its
state. If a commit failed the node is expected to have rolled back the
work.process
- the processITXPNode.State rollback(ITXProcess process)
ITXPNode.State.COMPLETED
or ITXPNode.State.FAILED
depending on
its state. NOTE if the node failed its work it is already rolled back and
will return ITXPNode.State.COMPLETED
but remain in state.
ITXPNode.State.FAILED
process
- the processITXPNode.State retry(ITXProcess process)
ITXPNode.State.OK
, ITXPNode.State.FAILED
or ITXPNode.State.UNABLE
depending on its state.process
- the processITXPNode.State undo(ITXProcess process)
ITXPNode.State.OK
, ITXPNode.State.FAILED
or
ITXPNode.State.UNABLE
depending on its state.
This is of course the 'crux'. It is the implementation that may or may not
be able to undo something. For instance. if the node is a JDBC transaction
it may know how to perform a compensating transaction; or not.process
- the processITXPNode.State recover(ITXProcess process)
ITXPNode.State.OK
, ITXPNode.State.FAILED
or
ITXPNode.State.UNABLE
depending on its state.
To be able to do this the node needs to log its state durably and use the
Processes Pid as a key.process
- the processiizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.