org.apache.ignite

## Interface IgniteTransactions

All Known Subinterfaces:
  IgniteTransactionsEx

All Known Implementing Classes:
  IgniteTransactionsImpl

    public interface IgniteTransactions

Transactions facade provides ACID-compliant semantic when working with caches. You can create a transaction when working with one cache or across multiple caches. Caches with different cache modes, like `PARTITIONED` or `REPLICATED`, can also participate in the same transaction.

Transactions are `AutoCloseable`, so they will automatically rollback unless explicitly committed.

Here is an example of a transaction:

     try (Transaction tx = Ignition.ignite().transactions().txStart()) {
       Account acct = cache.get(acctId);

       // Current balance.
       double balance = acct.getBalance();

       // Deposit $100 into account.
       acct.setBalance(balance + 100);

       // Store updated account in cache.
       cache.put(acctId, acct);

       tx.commit();
     }

### Method Summary

Methods
`TransactionMetrics` `metrics()`
`void` `resetMetrics()` Resets transaction metrics.
`Transaction` `tx()` Gets transaction started by this thread or `null` if this thread does not have a transaction.
`Transaction` `txStart()` Starts transaction with default isolation, concurrency, timeout, and invalidation policy.
`Transaction` `txStart(TransactionConcurrency concurrency, TransactionIsolation isolation)` Starts new transaction with the specified concurrency and isolation.
`Transaction` `txStart(TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, int txSize)` Starts transaction with specified isolation, concurrency, timeout, invalidation flag, and number of participating entries.

### Method Detail

#### txStart

    Transaction txStart()
                        throws IllegalStateException

Starts transaction with default isolation, concurrency, timeout, and invalidation policy. All defaults are set in `CacheConfiguration` at startup.

Returns:
  New transaction
Throws:
  `IllegalStateException` - If transaction is already started by this thread.
  `UnsupportedOperationException` - If cache is `CacheAtomicityMode.ATOMIC`.

#### txStart

    Transaction txStart(TransactionConcurrency concurrency,
                      TransactionIsolation isolation)

Starts new transaction with the specified concurrency and isolation.

Parameters:
  `concurrency` - Concurrency.
  `isolation` - Isolation.
Returns:
  New transaction.
Throws:
  `IllegalStateException` - If transaction is already started by this thread.
  `UnsupportedOperationException` - If cache is `CacheAtomicityMode.ATOMIC`.

#### txStart

    Transaction txStart(TransactionConcurrency concurrency,
                      TransactionIsolation isolation,
                      long timeout,
                      int txSize)

Starts transaction with specified isolation, concurrency, timeout, invalidation flag, and number of participating entries.

Parameters:
  `concurrency` - Concurrency.
  `isolation` - Isolation.
  `timeout` - Timeout.
  `txSize` - Number of entries participating in transaction (may be approximate).
Returns:
  New transaction.
Throws:
  `IllegalStateException` - If transaction is already started by this thread.
  `UnsupportedOperationException` - If cache is `CacheAtomicityMode.ATOMIC`.

#### tx

    Transaction tx()

Gets transaction started by this thread or `null` if this thread does not have a transaction.

Returns:
  Transaction started by this thread or `null` if this thread does not have a transaction.

#### metrics

    TransactionMetrics metrics()

Returns:
  Transaction metrics.

#### resetMetrics

    void resetMetrics()

Resets transaction metrics.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.3.0-incubating
Release Date | : July 10 2015