com.hazelcast.client.proxy.txn

## Class TransactionContextProxy

- java.lang.Object
- - com.hazelcast.client.proxy.txn.TransactionContextProxy

- All Implemented Interfaces:
    ClientTransactionContext, TransactionalTaskContext, TransactionContext

      public class TransactionContextProxy
      extends Object
      implements ClientTransactionContext

  Provides a context to perform transactional operations: beginning/committing transactions, but also retrieving transactional data-structures like the `TransactionalMap`. Provides client instance and client connection proxies that need to be accessed for sending invocations.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionContextProxy(com.hazelcast.client.spi.impl.ClientTransactionManagerServiceImpl transactionManager, TransactionOptions options)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginTransaction()` Begins a transaction.
    `void` | `commitTransaction()` Commits a transaction.
    `com.hazelcast.client.impl.HazelcastClientInstanceImpl` | `getClient()`
    `ClientConnection` | `getConnection()`
    `<E> TransactionalList<E>` | `getList(String name)` Returns the transactional list instance with the specified name.
    `<K,V> TransactionalMap<K,V>` | `getMap(String name)` Returns the transactional distributed map instance with the specified name.
    `<K,V> TransactionalMultiMap<K,V>` | `getMultiMap(String name)` Returns the transactional multimap instance with the specified name.
    `<E> TransactionalQueue<E>` | `getQueue(String name)` Returns the transactional queue instance with the specified name.
    `<E> TransactionalSet<E>` | `getSet(String name)` Returns the transactional set instance with the specified name.
    `<T extends TransactionalObject> T` | `getTransactionalObject(String serviceName, String name)` Returns the transactional object instance with the specified name and service name.
    `String` | `getTxnId()` Gets the ID that uniquely identifies the transaction.
    `XAResource` | `getXaResource()` Gets xaResource which will participate in XATransaction.
    `void` | `rollbackTransaction()` Rollback of the current transaction.

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

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

- - ### Constructor Detail

    - #### TransactionContextProxy

          public TransactionContextProxy(com.hazelcast.client.spi.impl.ClientTransactionManagerServiceImpl transactionManager,
                                         TransactionOptions options)

  - ### Method Detail

    - #### getTxnId

          public String getTxnId()

      Description copied from interface: `TransactionContext`
      Gets the ID that uniquely identifies the transaction.
      Specified by:
        `getTxnId` in interface `TransactionContext`
      Returns:
        the transaction ID

    - #### beginTransaction

          public void beginTransaction()

      Description copied from interface: `TransactionContext`
      Begins a transaction.
      Specified by:
        `beginTransaction` in interface `TransactionContext`

    - #### commitTransaction

          public void commitTransaction()
                                 throws TransactionException

      Description copied from interface: `TransactionContext`
      Commits a transaction.
      Specified by:
        `commitTransaction` in interface `TransactionContext`
      Throws:
        `TransactionException` - if no transaction is active or the transaction could not be committed.

    - #### rollbackTransaction

          public void rollbackTransaction()

      Description copied from interface: `TransactionContext`
      Rollback of the current transaction.
      Specified by:
        `rollbackTransaction` in interface `TransactionContext`

    - #### getMap

          public <K,V> TransactionalMap<K,V> getMap(String name)

      Description copied from interface: `TransactionalTaskContext`
      Returns the transactional distributed map instance with the specified name.
      Specified by:
        `getMap` in interface `TransactionalTaskContext`
      Parameters:
        `name` - name of the distributed transactional map
      Returns:
        transactional distributed map instance with the specified name

    - #### getQueue

          public <E> TransactionalQueue<E> getQueue(String name)

      Description copied from interface: `TransactionalTaskContext`
      Returns the transactional queue instance with the specified name.
      Specified by:
        `getQueue` in interface `TransactionalTaskContext`
      Parameters:
        `name` - name of the transactional queue
      Returns:
        transactional queue instance with the specified name

    - #### getMultiMap

          public <K,V> TransactionalMultiMap<K,V> getMultiMap(String name)

      Description copied from interface: `TransactionalTaskContext`
      Returns the transactional multimap instance with the specified name.
      Specified by:
        `getMultiMap` in interface `TransactionalTaskContext`
      Parameters:
        `name` - name of the transactional multimap
      Returns:
        transactional multimap instance with the specified name

    - #### getList

          public <E> TransactionalList<E> getList(String name)

      Description copied from interface: `TransactionalTaskContext`
      Returns the transactional list instance with the specified name.
      Specified by:
        `getList` in interface `TransactionalTaskContext`
      Parameters:
        `name` - name of the transactional list
      Returns:
        transactional list instance with the specified name

    - #### getSet

          public <E> TransactionalSet<E> getSet(String name)

      Description copied from interface: `TransactionalTaskContext`
      Returns the transactional set instance with the specified name.
      Specified by:
        `getSet` in interface `TransactionalTaskContext`
      Parameters:
        `name` - name of the transactional set
      Returns:
        transactional set instance with the specified name

    - #### getTransactionalObject

          public <T extends TransactionalObject> T getTransactionalObject(String serviceName,
                                                                          String name)

      Description copied from interface: `TransactionalTaskContext`
      Returns the transactional object instance with the specified name and service name.
      Specified by:
        `getTransactionalObject` in interface `TransactionalTaskContext`
      Parameters:
        `serviceName` - service name for the transactional object instance
        `name` - name of the transactional object instance
      Returns:
        transactional object instance with the specified name

    - #### getConnection

          public ClientConnection getConnection()

      Specified by:
        `getConnection` in interface `ClientTransactionContext`

    - #### getClient

          public com.hazelcast.client.impl.HazelcastClientInstanceImpl getClient()

      Specified by:
        `getClient` in interface `ClientTransactionContext`

    - #### getXaResource

          public XAResource getXaResource()

      Description copied from interface: `TransactionContext`
      Gets xaResource which will participate in XATransaction.
      Specified by:
        `getXaResource` in interface `TransactionContext`
      Returns:
        the xaResource.

Copyright © 2018. All rights reserved.