Class TxnFailureReport

java.lang.Object
com.github.sttk.sabi.TxnFailureReport

public final class TxnFailureReport extends Object
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 Details

    • dataConnName

      public final String dataConnName
      The logical name of the data connection.
    • dataConnType

      public final String dataConnType
      The fully qualified class name of the data connection.
    • cause

      public final TxnFailureCause cause
      The cause of the transaction failure for this connection.
    • rollback

      public final TxnFailureRollback rollback
      The rollback outcome for this connection.
  • Constructor Details

    • TxnFailureReport

      public TxnFailureReport(String name, String type, TxnFailureCause cause, TxnFailureRollback rollback)
      Constructs a new TxnFailureReport with the specified connection details, cause, and rollback outcome.
      Parameters:
      name - the logical name of the data connection
      type - the class name or type of the data connection
      cause - the transaction failure cause
      rollback - the rollback outcome
  • Method Details

    • toString

      public String toString()
      Returns a string representation of this transaction failure report.
      Overrides:
      toString in class Object
      Returns:
      a formatted string containing connection details, cause, and rollback outcome
    • isCauseOfFailure

      public boolean isCauseOfFailure()
      Determines whether this connection was a direct cause of the transaction failure.
      Returns:
      true if this connection caused the failure; false if the cause state is TxnFailureCauseState.NoneByCommitted or TxnFailureCauseState.NoneByUncommitted
    • recoveryForCommit

      public TxnFailureRecovery recoveryForCommit()
      Determines the recommended recovery strategy if the intent is to re-attempt and complete the transaction commit.
      Returns:
      the recommended TxnFailureRecovery action for committing
    • recoveryForRollback

      public TxnFailureRecovery recoveryForRollback()
      Determines the recommended recovery strategy if the intent is to cancel and roll back the transaction.
      Returns:
      the recommended TxnFailureRecovery action for rolling back