org.apache.ignite.transactions

## Class TransactionException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.apache.ignite.IgniteException
        - - org.apache.ignite.transactions.TransactionException

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    TransactionAlreadyCompletedException, TransactionDeadlockException, TransactionDuplicateKeyException, TransactionHeuristicException, TransactionMixedModeException, TransactionOptimisticException, TransactionRollbackException, TransactionSerializationException, TransactionTimeoutException, TransactionUnsupportedConcurrencyException

      public class TransactionException
      extends IgniteException

  Base class for all transaction related exceptions. In case of `CacheAtomicityMode.TRANSACTIONAL` cache - any method throwing this or nested exception have transactional behaviour (it can be rolled back and not seen outside transaction before committed). In case of `CacheAtomicityMode.ATOMIC` cache - every action is committed when it done.

  Before doing main thing, all transactional methods (commit, rollback and close) must obtain a readLock from context's gateway to prevent simultaneous actions which can break result of transaction. Then method delegates action to internal transaction representation which can fail in some cases and throw exception. Anyway, if there is success or fail, method must free gateway lock.

  `TransactionDeadlockException` If deadlock detected within transaction. `TransactionHeuristicException` If operation performs within transaction that entered an unknown state. `TransactionOptimisticException` If operation with optimistic behavior failed. `TransactionRollbackException` If operation performs within transaction that automatically rolled back. `TransactionTimeoutException` If operation performs within transaction and timeout occurred. `TransactionSerializationException` If operation performs within mvcc transaction and write conflict occurred.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionException()` Creates empty exception.
    `TransactionException(String msg)` Creates new exception with given error message.
    `TransactionException(String msg, @Nullable Throwable cause)` Creates new exception with given error message and optional nested exception.
    `TransactionException(Throwable cause)` Creates new transaction exception with given throwable as a cause and source of error message.

  - ### Method Summary

    - ### Methods inherited from class org.apache.ignite.IgniteException

      `getCause, hasCause, toString`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TransactionException

          public TransactionException()

      Creates empty exception.

    - #### TransactionException

          public TransactionException(String msg)

      Creates new exception with given error message.
      Parameters:
        `msg` - Error message.

    - #### TransactionException

          public TransactionException(Throwable cause)

      Creates new transaction exception with given throwable as a cause and source of error message.
      Parameters:
        `cause` - Non-null throwable cause.

    - #### TransactionException

          public TransactionException(String msg,
                                      @Nullable
                                      @Nullable Throwable cause)

      Creates new exception with given error message and optional nested exception.
      Parameters:
        `msg` - Error message.
        `cause` - Optional nested exception (can be `null`).

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020