Class TxnFailureReport
java.lang.Object
com.github.sttk.sabi.TxnFailureReport
Reports the failure cause and rollback outcome for a single
DataConn when a transaction
fails.
Instances are passed to DataConn.onTxnFailure(AsyncGroup, java.util.List) to provide
diagnostics and help determine recovery strategies via recoveryForCommit() and recoveryForRollback().
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal TxnFailureCauseThe cause of the transaction failure for this connection.final StringThe logical name of the data connection.final StringThe fully qualified class name of the data connection.final TxnFailureRollbackThe rollback outcome for this connection. -
Constructor Summary
ConstructorsConstructorDescriptionTxnFailureReport(String name, String type, TxnFailureCause cause, TxnFailureRollback rollback) Constructs a newTxnFailureReportwith the specified connection details, cause, and rollback outcome. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines whether this connection was a direct cause of the transaction failure.Determines the recommended recovery strategy if the intent is to re-attempt and complete the transaction commit.Determines the recommended recovery strategy if the intent is to cancel and roll back the transaction.toString()Returns a string representation of this transaction failure report.
-
Field Details
-
dataConnName
The logical name of the data connection. -
dataConnType
The fully qualified class name of the data connection. -
cause
The cause of the transaction failure for this connection. -
rollback
The rollback outcome for this connection.
-
-
Constructor Details
-
TxnFailureReport
public TxnFailureReport(String name, String type, TxnFailureCause cause, TxnFailureRollback rollback) Constructs a newTxnFailureReportwith the specified connection details, cause, and rollback outcome.- Parameters:
name- the logical name of the data connectiontype- the class name or type of the data connectioncause- the transaction failure causerollback- the rollback outcome
-
-
Method Details
-
toString
-
isCauseOfFailure
public boolean isCauseOfFailure()Determines whether this connection was a direct cause of the transaction failure.- Returns:
trueif this connection caused the failure;falseif the cause state isTxnFailureCauseState.NoneByCommittedorTxnFailureCauseState.NoneByUncommitted
-
recoveryForCommit
Determines the recommended recovery strategy if the intent is to re-attempt and complete the transaction commit.- Returns:
- the recommended
TxnFailureRecoveryaction for committing
-
recoveryForRollback
Determines the recommended recovery strategy if the intent is to cancel and roll back the transaction.- Returns:
- the recommended
TxnFailureRecoveryaction for rolling back
-