Aborts the transaction, specifying the cause. This notifies all participants that the transaction has aborted, and invalidates all future use of this transaction. The caller should always follow a call to
abort
by throwing an exception that details why the transaction was aborted. If the exception could be caught by application code, then the exception thrown should be a {@link TransactionAbortedException}, created by wrapping the original cause if needed. Throwing an exception is needed not only to communicate the cause of the abort and whether to retry the exception, but also because the application code associated with this transaction will continue to execute normally unless an exception is raised. Supplying the cause to this method allows future calls to the transaction to include the cause to explain why the transaction is no longer active.
If the transaction has been aborted, then the exception thrown will have as its cause the value provided in the first call to {@link #abort abort}, if any. If the cause implements {@link ExceptionRetryStatus}, then the exception thrown will, too, and its {@link ExceptionRetryStatus#shouldRetry shouldRetry} method will return thevalue returned by calling that method on the cause.
@param cause the exception that caused the abort
@throws TransactionNotActiveException if the transaction has beenaborted
@throws IllegalStateException if all transaction participants have beenprepared and {@link #abort abort} has notbeen called, or if called from a thread that is not the thread that created this transaction