org.apache.ignite.internal.processors.cache.distributed.dht

## Class GridDhtTxLocalAdapter

- java.lang.Object
- - org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
  - - org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
    - - org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
      - - org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter

All Implemented Interfaces:
  Externalizable, Serializable, IgniteInternalTx, IgniteTxLocalEx

Direct Known Subclasses:
  GridDhtTxLocal, GridNearTxLocal

    public abstract class GridDhtTxLocalAdapter
    extends IgniteTxLocalAdapter

Replicated user transaction.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter

`IgniteTxLocalAdapter.PLC1<T>, IgniteTxLocalAdapter.PLC2<T>, IgniteTxLocalAdapter.PMC<T>, IgniteTxLocalAdapter.PostLockClosure1<T>, IgniteTxLocalAdapter.PostLockClosure2<T>, IgniteTxLocalAdapter.PostMissClosure<T>`

### Nested classes/interfaces inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter

`GridMetadataAwareAdapter.EntryKey`

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx

`IgniteInternalTx.FinalizationStatus`

### Field Summary

Fields
`protected Map<UUID,GridDistributedTxMapping>` `dhtMap` DHT mappings.
`protected boolean` `explicitLock`
`protected boolean` `mapped` Mapped flag.
`protected Map<UUID,GridDistributedTxMapping>` `nearMap` Near mappings.

### Fields inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter

`COMMIT_ERR_UPD, commitErr, DONE_FLAG_UPD, doneFlag, implicitRes, minVer, syncMode, txState`

### Fields inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter

`cctx, concurrency, endVer, implicit, internal, invalidate, isDone, isolation, loc, log, needRetVal, nodeId, onePhaseCommit, startTime, startVer, storeEnabled, subjId, taskName, taskNameHash, threadId, timeout, topVer, txNodes, txSize, writeVer, xidVer`

### Constructor Summary

Constructors
`protected` `GridDhtTxLocalAdapter()` Empty constructor required for `Externalizable`.
`protected` `GridDhtTxLocalAdapter(GridCacheSharedContext cctx, GridCacheVersion xidVer, boolean implicit, boolean implicitSingle, boolean sys, boolean explicitLock, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean invalidate, boolean storeEnabled, boolean onePhaseCommit, int txSize, UUID subjId, int taskNameHash)`

### Method Summary

Methods
`IgniteInternalFuture<Boolean>` `addEntry(long msgId, IgniteTxEntry e)`
`void` `addInvalidPartition(GridCacheContext ctx, int part)`
`protected abstract IgniteInternalFuture<Boolean>` `addReader(long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer)` Adds reader to cached entry.
`protected IgniteInternalFuture<GridNearTxPrepareResponse>` `chainOnePhasePrepare(GridDhtTxPrepareFuture prepFut)`
`protected abstract void` `clearPrepareFuture(GridDhtTxPrepareFuture fut)` Removes previously created prepare future from atomic reference.
`boolean` `commitOnPrepare()`
`boolean` `explicitLock()`
`void` `explicitLock(boolean explicitLock)`
`boolean` `localFinish(boolean commit)` Finishes transaction (either commit or rollback).
`protected void` `mapExplicitLocks()` Map explicit locks.
`protected abstract IgniteUuid` `nearFutureId()`
`protected abstract UUID` `nearNodeId()`
`void` `nearOnOriginatingNode(boolean hasNear)` Sets flag that indicates that originating node has a near cache that participates in this transaction.
`boolean` `needsCompletedVersions()`
`void` `pendingVersions(Collection<GridCacheVersion> pendingVers)`
`boolean` `removeMapping(UUID nodeId)`
`protected abstract void` `sendFinishReply(Throwable err)`
`String` `toString()`

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

`accessPolicy, accessPolicy, activeCachesDeploymentEnabled, activeCachesDeploymentEnabled, addActiveCache, addEntry, addInvokeResult, allEntries, alternateVersions, checkValid, commitAfterLock, commitError, commitError, committedVersions, completedBase, completedVersions, empty, entry, entryEx, entryEx, entryExpireTime, entryTtl, eventNodeId, hasInterceptor, hasWriteKey, implicitSingleResult, init, initResult, isStarted, masterNodeIds, minVersion, onOwnerChanged, originatingNodeId, peek, postLockWrite, readEntries, readMap, readSet, rolledbackVersions, seal, sendTransformedValues, syncMode, syncMode, tmFinish, txState, updateExplicitVersion, userCommit, userPrepare, userRollback, writeEntries, writeMap, writeSet`

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

`applyTransformClosures, batchStoreCommit, checkInternal, colocated, commitVersion, commitVersion, concurrency, conflictResolve, currentPrepareFuture, dht, done, endVersion, equals, errorWhenCommitting, evictNearEntry, finalizationStatus, finishFuture, hashCode, implicit, implicitSingle, internal, invalidate, invalidPartitions, ioPolicy, isInvalidate, isNearLocallyMapped, isolation, isRollbackOnly, isSystemInvalidate, isWriteToStoreFromDhtValid, local, localResult, log, markFinalizing, near, nearXidVersion, needReturnValue, needReturnValue, nodeId, onePhaseCommit, onePhaseCommit, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, readExternal, readResolve, remainingTime, repeatableRead, resolveTaskName, serializable, sessionEnd, setRollbackOnly, size, startTime, state, state, state, storeEnabled, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, timeout, timeout, timeoutException, topologyVersion, topologyVersion, topologyVersionSnapshot, transactionNodes, transactionNodes, uncommit, updateNearCache, user, writeExternal, writeVersion, writeVersion, xid, xidVersion`

### Methods inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter

`addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, readExternalMeta, removeAllMeta, removeMeta, removeMeta, replaceMeta, writeExternalMeta`

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

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx

`addMeta, colocated, commitAsync, commitVersion, commitVersion, concurrency, currentPrepareFuture, dht, done, endVersion, errorWhenCommitting, finishFuture, implicit, implicitSingle, internal, invalidate, invalidPartitions, ioPolicy, isInvalidate, isolation, isRollbackOnly, isSystemInvalidate, local, localResult, markFinalizing, meta, near, nearXidVersion, nodeId, onePhaseCommit, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, remainingTime, removeMeta, repeatableRead, rollbackAsync, salvageTx, serializable, setRollbackOnly, size, startTime, state, state, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, timeout, timeout, topologyVersion, topologyVersion, topologyVersionSnapshot, transactionNodes, user, writeVersion, writeVersion, xid, xidVersion`

### Field Detail

#### nearMap

    protected Map<UUID,GridDistributedTxMapping> nearMap

Near mappings.

#### dhtMap

    protected Map<UUID,GridDistributedTxMapping> dhtMap

DHT mappings.

#### mapped

    protected volatile boolean mapped

Mapped flag.

#### explicitLock

    protected boolean explicitLock

### Constructor Detail

#### GridDhtTxLocalAdapter

    protected GridDhtTxLocalAdapter()

Empty constructor required for `Externalizable`.

#### GridDhtTxLocalAdapter

    protected GridDhtTxLocalAdapter(GridCacheSharedContext cctx,
                         GridCacheVersion xidVer,
                         boolean implicit,
                         boolean implicitSingle,
                         boolean sys,
                         boolean explicitLock,
                         byte plc,
                         TransactionConcurrency concurrency,
                         TransactionIsolation isolation,
                         long timeout,
                         boolean invalidate,
                         boolean storeEnabled,
                         boolean onePhaseCommit,
                         int txSize,
                         @Nullable
                         UUID subjId,
                         int taskNameHash)

Parameters:
  `xidVer` - Transaction version.
  `implicit` - Implicit flag.
  `implicitSingle` - Implicit-with-single-key flag.
  `cctx` - Cache context.
  `sys` - System flag.
  `concurrency` - Concurrency.
  `isolation` - Isolation.
  `timeout` - Timeout.
  `txSize` - Expected transaction size.

### Method Detail

#### nearOnOriginatingNode

    public void nearOnOriginatingNode(boolean hasNear)

Sets flag that indicates that originating node has a near cache that participates in this transaction.

Parameters:
  `hasNear` - Has near cache flag.

#### explicitLock

    public boolean explicitLock()

Returns:
  `True` if explicit lock transaction.

#### explicitLock

    public void explicitLock(boolean explicitLock)

Parameters:
  `explicitLock` - Explicit lock flag.

#### nearNodeId

    protected abstract UUID nearNodeId()

Returns:
  Near node id.

#### nearFutureId

    protected abstract IgniteUuid nearFutureId()

Returns:
  Near future ID.

#### addReader

    @Nullable
    protected abstract IgniteInternalFuture<Boolean> addReader(long msgId,
                                                   GridDhtCacheEntry cached,
                                                   IgniteTxEntry entry,
                                                   AffinityTopologyVersion topVer)

Adds reader to cached entry.

Parameters:
  `msgId` - Message ID.
  `cached` - Cached entry.
  `entry` - Transaction entry.
  `topVer` - Topology version.
Returns:
  `True` if reader was added as a result of this call.

#### sendFinishReply

    protected abstract void sendFinishReply(@Nullable
                       Throwable err)

Parameters:
  `err` - Error, if any.

#### needsCompletedVersions

    public boolean needsCompletedVersions()

Specified by:
  `needsCompletedVersions` in interface `IgniteInternalTx`
Overrides:
  `needsCompletedVersions` in class `IgniteTxAdapter`
Returns:
  `True` if transaction needs completed versions for processing.

#### pendingVersions

    public void pendingVersions(Collection<GridCacheVersion> pendingVers)

Parameters:
  `pendingVers` - Versions for all pending locks that were in queue before tx locsk were released.

#### mapExplicitLocks

    protected void mapExplicitLocks()

Map explicit locks.

#### removeMapping

    public boolean removeMapping(UUID nodeId)

Parameters:
  `nodeId` - Node ID.
Returns:
  `True` if mapping was removed.

#### addInvalidPartition

    public void addInvalidPartition(GridCacheContext ctx,
                           int part)

Specified by:
  `addInvalidPartition` in interface `IgniteInternalTx`
Overrides:
  `addInvalidPartition` in class `IgniteTxAdapter`
Parameters:
  `ctx` - Cache context.
  `part` - Invalid partition.

#### addEntry

    @Nullable
    public IgniteInternalFuture<Boolean> addEntry(long msgId,
                                                  IgniteTxEntry e)
                                           throws IgniteCheckedException

Parameters:
  `msgId` - Message ID.
  `e` - Entry to add.
Returns:
  Future for active transactions for the time when reader was added.
Throws:
  `IgniteCheckedException` - If failed.

#### localFinish

    public boolean localFinish(boolean commit)
                        throws IgniteCheckedException

Finishes transaction (either commit or rollback).

Parameters:
  `commit` - `True` if commit, `false` if rollback.
Returns:
  `True` if state has been changed.
Throws:
  `IgniteCheckedException` - If finish failed.

#### clearPrepareFuture

    protected abstract void clearPrepareFuture(GridDhtTxPrepareFuture fut)

Removes previously created prepare future from atomic reference.

Parameters:
  `fut` - Expected future.

#### commitOnPrepare

    public final boolean commitOnPrepare()

Returns:
  `True` if transaction is finished on prepare step.

#### chainOnePhasePrepare

    protected final IgniteInternalFuture<GridNearTxPrepareResponse> chainOnePhasePrepare(GridDhtTxPrepareFuture prepFut)

Parameters:
  `prepFut` - Prepare future.
Returns:
  If transaction if finished on prepare step returns future which is completed after transaction finish.

#### toString

    public String toString()

Overrides:
  `toString` in class `IgniteTxLocalAdapter`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017