Package st.orm

Class TransactionCallbackException

All Implemented Interfaces:
Serializable

public class TransactionCallbackException extends PersistenceException
Thrown when a transaction completion callback fails.

Callbacks run after the transaction has completed, so this exception reports a failed side effect rather than a failed transaction. isCommitted() says which completion it followed: true when the transaction committed, false when it rolled back.

Catching this type is what lets a caller tell "the work was not persisted" apart from "the work was persisted and something after it failed". The two need opposite responses: the first is a candidate for a retry, the second usually is not, because retrying repeats work that already succeeded.

When several callbacks fail, the first failure is the cause and the remaining ones are attached to it as suppressed exceptions. A callback failure that follows a rollback caused by another exception is not thrown on its own: it is attached to that exception as suppressed, still wrapped in this type.

Since:
1.13
See Also:
  • Constructor Details

    • TransactionCallbackException

      public TransactionCallbackException(String message, Throwable cause, boolean committed)
  • Method Details

    • isCommitted

      public boolean isCommitted()
      Whether the transaction committed before the failing callback ran.
      Returns:
      true when the transaction committed, false when it rolled back.