Package org.apache.ignite.internal.processors.cache.transactions

## Class IgniteTxStateImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalStateAdapter
  - - org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateImpl

All Implemented Interfaces:
  `IgniteTxLocalState`, `IgniteTxState`

    public class IgniteTxStateImpl
    extends IgniteTxLocalStateAdapter

### Constructor Summary

Constructors
`IgniteTxStateImpl()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addActiveCache​(GridCacheContext cacheCtx, boolean recovery, IgniteTxAdapter tx)`
`void` `addEntry​(IgniteTxEntry entry)`
`Collection<IgniteTxEntry>` `allEntries()`
`Collection<IgniteTxEntry>` `allEntriesCopy()`
`void` `awaitLastFuture()` Awaits for previous async operations on active caches to be completed.
`@Nullable GridIntList` `cacheIds()` Gets caches ids affected with current tx.
`boolean` `empty()`
`IgniteTxEntry` `entry​(IgniteTxKey key)`
`@Nullable Integer` `firstCacheId()`
`boolean` `hasInterceptor​(GridCacheSharedContext cctx)`
`boolean` `hasWriteKey​(IgniteTxKey key)`
`boolean` `implicitSingle()`
`boolean` `init​(int txSize)`
`boolean` `initialized()`
`GridCacheAdapter.FutureHolder` `lastAsyncFuture()` Previous async operations on caches.
`void` `onTxEnd​(GridCacheSharedContext cctx, IgniteInternalTx tx, boolean commit)`
`Collection<IgniteTxEntry>` `readEntries()`
`Map<IgniteTxKey,​IgniteTxEntry>` `readMap()`
`Set<IgniteTxKey>` `readSet()`
`boolean` `recovery()`
`void` `removeEntry​(IgniteTxKey key)`
`void` `seal()`
`IgniteTxEntry` `singleWrite()`
`Collection<CacheStoreManager>` `stores​(GridCacheSharedContext cctx)`
`boolean` `storeWriteThrough​(GridCacheSharedContext sctx)`
`CacheWriteSynchronizationMode` `syncMode​(GridCacheSharedContext cctx)`
`GridDhtTopologyFuture` `topologyReadLock​(GridCacheSharedContext cctx, GridFutureAdapter<?> fut)`
`void` `topologyReadUnlock​(GridCacheSharedContext cctx)`
`String` `toString()`
`void` `unwindEvicts​(GridCacheSharedContext cctx)` Unwind evicts for caches involved in this transaction.
`IgniteCheckedException` `validateTopology​(GridCacheSharedContext cctx, boolean read, GridDhtTopologyFuture topFut)`
`Collection<IgniteTxEntry>` `writeEntries()`
`Map<IgniteTxKey,​IgniteTxEntry>` `writeMap()`
`Set<IgniteTxKey>` `writeSet()`

### Methods inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalStateAdapter

`onTxEnd`

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

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

### Constructor Detail

#### IgniteTxStateImpl

    public IgniteTxStateImpl()

### Method Detail

#### implicitSingle

    public boolean implicitSingle()

Returns:
  Flag indicating whether transaction is implicit with only one key.

#### firstCacheId

    @Nullable
    public @Nullable Integer firstCacheId()

Returns:
  First tx cache id.

#### cacheIds

    @Nullable
    public @Nullable GridIntList cacheIds()

Gets caches ids affected with current tx.

Returns:
  tx cache ids.

#### unwindEvicts

    public void unwindEvicts​(GridCacheSharedContext cctx)

Unwind evicts for caches involved in this transaction.

Parameters:
  `cctx` - Grid cache shared context.

#### awaitLastFuture

    public void awaitLastFuture()

Awaits for previous async operations on active caches to be completed.

#### lastAsyncFuture

    public GridCacheAdapter.FutureHolder lastAsyncFuture()

Previous async operations on caches.

#### validateTopology

    public IgniteCheckedException validateTopology​(GridCacheSharedContext cctx,
                                                   boolean read,
                                                   GridDhtTopologyFuture topFut)

Parameters:
  `cctx` - Context.
  `read` - `True` if validating for a read operation, `false` for write.
  `topFut` - Topology future.
Returns:
  Error if validation failed.

#### recovery

    public boolean recovery()

Returns:
  Recovery mode flag.

#### syncMode

    public CacheWriteSynchronizationMode syncMode​(GridCacheSharedContext cctx)

Parameters:
  `cctx` - Context.
Returns:
  Write synchronization mode.

#### addActiveCache

    public void addActiveCache​(GridCacheContext cacheCtx,
                               boolean recovery,
                               IgniteTxAdapter tx)
                        throws IgniteCheckedException

Parameters:
  `cacheCtx` - Context.
  `tx` - Transaction.
Throws:
  `IgniteCheckedException` - If cache check failed.

#### topologyReadLock

    public GridDhtTopologyFuture topologyReadLock​(GridCacheSharedContext cctx,
                                                  GridFutureAdapter<?> fut)

Parameters:
  `cctx` - Context.
  `fut` - Future to finish with error if some cache is stopping.
Returns:
  Topology future.

#### topologyReadUnlock

    public void topologyReadUnlock​(GridCacheSharedContext cctx)

Parameters:
  `cctx` - Context.

#### storeWriteThrough

    public boolean storeWriteThrough​(GridCacheSharedContext sctx)

Parameters:
  `sctx` - Context.
Returns:
  `True` if transaction is allowed to use store and transactions spans one or more caches with store enabled.

#### hasInterceptor

    public boolean hasInterceptor​(GridCacheSharedContext cctx)

Parameters:
  `cctx` - Context.
Returns:
  `True` if transaction spans one or more caches with configured interceptor.

#### stores

    public Collection<CacheStoreManager> stores​(GridCacheSharedContext cctx)

Parameters:
  `cctx` - Context.
Returns:
  Configured stores for active caches.

#### onTxEnd

    public void onTxEnd​(GridCacheSharedContext cctx,
                        IgniteInternalTx tx,
                        boolean commit)

Parameters:
  `cctx` - Context.
  `tx` - Transaction.
  `commit` - Commit flag.

#### init

    public boolean init​(int txSize)

Parameters:
  `txSize` - Transaction size.
Returns:
  `True` if transaction was successfully started.

#### initialized

    public boolean initialized()

Returns:
  `True` if init method was called.

#### allEntries

    public Collection<IgniteTxEntry> allEntries()

Returns:
  All entries.

#### allEntriesCopy

    public Collection<IgniteTxEntry> allEntriesCopy()

Returns:
  All entries. Returned collection is copy of internal collection.

#### entry

    public IgniteTxEntry entry​(IgniteTxKey key)

Parameters:
  `key` - Key.
Returns:
  Entry.

#### hasWriteKey

    public boolean hasWriteKey​(IgniteTxKey key)

Parameters:
  `key` - Key.
Returns:
  `True` if tx has write key.

#### readSet

    public Set<IgniteTxKey> readSet()

Returns:
  Read entries keys.

#### writeSet

    public Set<IgniteTxKey> writeSet()

Returns:
  Write entries keys.

#### writeEntries

    public Collection<IgniteTxEntry> writeEntries()

Returns:
  Write entries.

#### readEntries

    public Collection<IgniteTxEntry> readEntries()

Returns:
  Read entries.

#### writeMap

    public Map<IgniteTxKey,​IgniteTxEntry> writeMap()

Returns:
  Write entries map.

#### readMap

    public Map<IgniteTxKey,​IgniteTxEntry> readMap()

Returns:
  Read entries map.

#### empty

    public boolean empty()

Returns:
  `True` if transaction is empty.

#### addEntry

    public void addEntry​(IgniteTxEntry entry)

Parameters:
  `entry` - Entry.

#### removeEntry

    public void removeEntry​(IgniteTxKey key)

Parameters:
  `key` - Key.

#### seal

    public void seal()

#### singleWrite

    public IgniteTxEntry singleWrite()

Returns:
  Non-null entry if tx has only one write entry.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`