com.hazelcast.transaction

## Interface TransactionContext

- All Superinterfaces:
    TransactionalTaskContext
  All Known Subinterfaces:
    ClientTransactionContext
  All Known Implementing Classes:
    TransactionContextProxy, XATransactionContextProxy

      public interface TransactionContext
      extends TransactionalTaskContext

  Provides a context to perform transactional operations: beginning/committing transactions, but also retrieving transactional data-structures like the `TransactionalMap`. Any method accessed through TransactionContext interface can throw TransactionException if transaction is no longer valid and rolled back.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginTransaction()` Begins a transaction.
    `void` | `commitTransaction()` Commits a transaction.
    `String` | `getTxnId()` Gets the ID that uniquely identifies the transaction.
    `XAResource` | `getXaResource()` Deprecated. since 3.5 please use HazelcastInstance.getXAResource()
    `void` | `rollbackTransaction()` Rollback of the current transaction.

    - ### Methods inherited from interface com.hazelcast.transaction.TransactionalTaskContext

      `getList, getMap, getMultiMap, getQueue, getSet, getTransactionalObject`

- - ### Method Detail

    - #### beginTransaction

          void beginTransaction()

      Begins a transaction.
      Throws:
        `IllegalStateException` - if a transaction already is active.

    - #### commitTransaction

          void commitTransaction()
                          throws TransactionException

      Commits a transaction.
      Throws:
        `TransactionException` - if no transaction is active or the transaction could not be committed.

    - #### rollbackTransaction

          void rollbackTransaction()

      Rollback of the current transaction.
      Throws:
        `IllegalStateException` - if there is no active transaction.

    - #### getTxnId

          String getTxnId()

      Gets the ID that uniquely identifies the transaction.
      Returns:
        the transaction ID

    - #### getXaResource

          @Deprecated
          XAResource getXaResource()

      Deprecated. since 3.5 please use HazelcastInstance.getXAResource()
      Gets xaResource which will participate in XATransaction.
      Returns:
        the xaResource.

Copyright © 2019. All rights reserved.