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

## Class GridNearTxPrepareFutureAdapter

- java.lang.Object
- - java.util.concurrent.locks.AbstractOwnableSynchronizer
  - - java.util.concurrent.locks.AbstractQueuedSynchronizer
    - - org.apache.ignite.internal.util.future.GridFutureAdapter<R>
      - - org.apache.ignite.internal.util.future.GridCompoundFuture<T,T>
        - - org.apache.ignite.internal.util.future.GridCompoundIdentityFuture<IgniteInternalTx>
          - - org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareFutureAdapter

All Implemented Interfaces:
  Serializable, IgniteInternalFuture<IgniteInternalTx>, GridCacheFuture<IgniteInternalTx>

Direct Known Subclasses:
  GridNearOptimisticTxPrepareFuture, GridNearPessimisticTxPrepareFuture

    public abstract class GridNearTxPrepareFutureAdapter
    extends GridCompoundIdentityFuture<IgniteInternalTx>
    implements GridCacheFuture<IgniteInternalTx>

Common code for tx prepare in optimistic and pessimistic modes.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer

`AbstractQueuedSynchronizer.ConditionObject`

### Field Summary

Fields
`protected GridCacheSharedContext<?,?>` `cctx` Context.
`protected AtomicReference<Throwable>` `err` Error.
`protected IgniteUuid` `futId` Future ID.
`protected static IgniteLogger` `log` Logger.
`protected static AtomicReference<IgniteLogger>` `logRef` Logger reference.
`protected boolean` `trackable` Trackable flag.
`protected GridNearTxLocal` `tx` Transaction.
`protected GridDhtTxMapping` `txMapping` Full information about transaction nodes mapping.

### Constructor Summary

Constructors
Constructor and Description
`GridNearTxPrepareFutureAdapter(GridCacheSharedContext cctx, GridNearTxLocal tx)`

### Method Summary

Methods
`protected void` `checkOnePhase()` Checks if mapped transaction can be committed on one phase.
`IgniteUuid` `futureId()`
`void` `markNotTrackable()` Marks this future as non-trackable.
`protected void` `onPrepareResponse(GridDistributedTxMapping m, GridNearTxPrepareResponse res)`
`abstract void` `onResult(UUID nodeId, GridNearTxPrepareResponse res)`
`abstract void` `prepare()` Prepares transaction.
`boolean` `trackable()`
`GridCacheVersion` `version()`

### Methods inherited from class org.apache.ignite.internal.util.future.GridCompoundIdentityFuture

`toString`

### Methods inherited from class org.apache.ignite.internal.util.future.GridCompoundFuture

`add, addAll, addAll, cancel, futures, hasPending, ignoreChildFailures, initialized, markInitialized, pending, reducer, reducer`

### Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter

`chain, duration, endTime, error, get, get, get, get0, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, onCancelled, onDone, onDone, onDone, onDone, result, startTime, tryAcquireShared, tryReleaseShared`

### Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer

`acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isHeldExclusively, isQueued, owns, release, releaseShared, setState, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryRelease`

### Methods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer

`getExclusiveOwnerThread, setExclusiveOwnerThread`

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

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

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

`nodes, onNodeLeft`

### Methods inherited from interface org.apache.ignite.internal.IgniteInternalFuture

`cancel, chain, duration, error, get, get, get, getUninterruptibly, isCancelled, isDone, listen, result, startTime`

### Field Detail

#### logRef

    protected static final AtomicReference<IgniteLogger> logRef

Logger reference.

#### log

    protected static IgniteLogger log

Logger.

#### cctx

    protected GridCacheSharedContext<?,?> cctx

Context.

#### futId

    protected IgniteUuid futId

Future ID.

#### tx

    @GridToStringInclude
    protected GridNearTxLocal tx

Transaction.

#### err

    @GridToStringExclude
    protected AtomicReference<Throwable> err

Error.

#### trackable

    protected boolean trackable

Trackable flag.

#### txMapping

    protected GridDhtTxMapping txMapping

Full information about transaction nodes mapping.

### Constructor Detail

#### GridNearTxPrepareFutureAdapter

    public GridNearTxPrepareFutureAdapter(GridCacheSharedContext cctx,
                                  GridNearTxLocal tx)

Parameters:
  `cctx` - Context.
  `tx` - Transaction.

### Method Detail

#### futureId

    public IgniteUuid futureId()

Specified by:
  `futureId` in interface `GridCacheFuture<IgniteInternalTx>`
Returns:
  Unique identifier for this future.

#### version

    public GridCacheVersion version()

Specified by:
  `version` in interface `GridCacheFuture<IgniteInternalTx>`
Returns:
  Future version.

#### markNotTrackable

    public void markNotTrackable()

Marks this future as non-trackable.

Specified by:
  `markNotTrackable` in interface `GridCacheFuture<IgniteInternalTx>`

#### trackable

    public boolean trackable()

Specified by:
  `trackable` in interface `GridCacheFuture<IgniteInternalTx>`
Returns:
  `True` if future should be tracked.

#### prepare

    public abstract void prepare()

Prepares transaction.

#### onResult

    public abstract void onResult(UUID nodeId,
                GridNearTxPrepareResponse res)

Parameters:
  `nodeId` - Sender.
  `res` - Result.

#### checkOnePhase

    protected final void checkOnePhase()

Checks if mapped transaction can be committed on one phase. One-phase commit can be done if transaction maps to one primary node and not more than one backup.

#### onPrepareResponse

    protected final void onPrepareResponse(GridDistributedTxMapping m,
                         GridNearTxPrepareResponse res)

Parameters:
  `m` - Mapping.
  `res` - Response.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015