Class UnexpectedRollbackException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.ultikits.ultitools.exceptions.UltiToolsException
com.ultikits.ultitools.exceptions.UnexpectedRollbackException
- All Implemented Interfaces:
Serializable
Signals that a transaction's outer
commit() found the transaction already marked
rollback-only by a nested scope, and performed a real rollback instead of committing.
This is the analogue of the signal a Spring-family container raises
(org.springframework.transaction.UnexpectedRollbackException) when an outer commit
discovers an inner scope already decided the whole transaction cannot succeed. Before D-08, the
inner scope's decision was discarded silently - the outer commit() logged a WARNING and
returned normally, leaving the caller believing its work was persisted when it was not. Throwing
this instead makes that outcome observable.
- Since:
- 6.3.0
- Author:
- wisdomme
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionUnexpectedRollbackException(ErrorCode errorCode, String message) Creates a new unexpected-rollback exception with a specific error code.UnexpectedRollbackException(ErrorCode errorCode, String message, Throwable cause) Creates a new unexpected-rollback exception with error code, message, and cause.UnexpectedRollbackException(String message) Creates a new unexpected-rollback exception with a generic error code.UnexpectedRollbackException(String message, Throwable cause) Creates a new unexpected-rollback exception with message and cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic UnexpectedRollbackExceptionCreates an exception naming the nested scope that marked the transaction rollback-only.Methods inherited from class com.ultikits.ultitools.exceptions.UltiToolsException
getErrorCode, getFormattedMessage, toStringMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
UnexpectedRollbackException
Creates a new unexpected-rollback exception with a generic error code.- Parameters:
message- the error message
-
UnexpectedRollbackException
Creates a new unexpected-rollback exception with a specific error code.- Parameters:
errorCode- the error codemessage- the error message
-
UnexpectedRollbackException
Creates a new unexpected-rollback exception with message and cause.- Parameters:
message- the error messagecause- the underlying cause
-
UnexpectedRollbackException
Creates a new unexpected-rollback exception with error code, message, and cause.- Parameters:
errorCode- the error codemessage- the error messagecause- the underlying cause
-
-
Method Details
-
markedBy
Creates an exception naming the nested scope that marked the transaction rollback-only.- Parameters:
origin- a description of the nested scope that set the marker (e.g. a method name or transaction depth) - included verbatim in the message- Returns:
- a new UnexpectedRollbackException
-