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

## Class GridDhtTxPrepareFuture<K,V>

- 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.dht.GridDhtTxPrepareFuture<K,V>

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

    public final class GridDhtTxPrepareFuture<K,V>
    extends GridCompoundIdentityFuture<IgniteInternalTx>
    implements GridCacheMvccFuture<IgniteInternalTx>

See Also:
  Serialized Form

### Nested Class Summary

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

`AbstractQueuedSynchronizer.ConditionObject`

### Constructor Summary

Constructors
Constructor and Description
`GridDhtTxPrepareFuture(GridCacheSharedContext cctx, GridDhtTxLocalAdapter tx, IgniteUuid nearMiniId, Map<IgniteTxKey,GridCacheVersion> dhtVerMap, boolean last, boolean retVal, Collection<UUID> lastBackups, IgniteInClosure<GridNearTxPrepareResponse> completeCb)`

### Method Summary

Methods
`void` `complete()` Completes this future.
`IgniteUuid` `futureId()`
`void` `markNotTrackable()` Marks this future as non-trackable.
`IgniteUuid` `nearMiniId()`
`Collection<? extends ClusterNode>` `nodes()`
`boolean` `onDone(IgniteInternalTx tx0, Throwable err)` Callback to notify that future is finished.
`void` `onError(Throwable t)`
`boolean` `onNodeLeft(UUID nodeId)` Callback for when node left.
`boolean` `onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner)`
`void` `onResult(UUID nodeId, GridDhtTxPrepareResponse res)`
`void` `prepare(Iterable<IgniteTxEntry> reads, Iterable<IgniteTxEntry> writes, Map<UUID,Collection<UUID>> txNodes)` Initializes future.
`String` `toString()`
`boolean` `trackable()`
`GridCacheVersion` `version()`

### 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, isCancelled, isDone, isFailed, listen, onCancelled, 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.IgniteInternalFuture

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

### Constructor Detail

#### GridDhtTxPrepareFuture

    public GridDhtTxPrepareFuture(GridCacheSharedContext cctx,
                          GridDhtTxLocalAdapter tx,
                          IgniteUuid nearMiniId,
                          Map<IgniteTxKey,GridCacheVersion> dhtVerMap,
                          boolean last,
                          boolean retVal,
                          Collection<UUID> lastBackups,
                          IgniteInClosure<GridNearTxPrepareResponse> completeCb)

Parameters:
  `cctx` - Context.
  `tx` - Transaction.
  `nearMiniId` - Near mini future id.
  `dhtVerMap` - DHT versions map.
  `last` - `True` if this is last prepare operation for node.
  `lastBackups` - IDs of backup nodes receiving last prepare request during this prepare.

### Method Detail

#### futureId

    public IgniteUuid futureId()

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

#### nearMiniId

    public IgniteUuid nearMiniId()

Returns:
  Near mini future id.

#### version

    public GridCacheVersion version()

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

#### nodes

    public Collection<? extends ClusterNode> nodes()

Specified by:
  `nodes` in interface `GridCacheFuture<IgniteInternalTx>`
Returns:
  Involved nodes.

#### onOwnerChanged

    public boolean onOwnerChanged(GridCacheEntryEx entry,
                         GridCacheMvccCandidate owner)

Specified by:
  `onOwnerChanged` in interface `GridCacheMvccFuture<IgniteInternalTx>`
Parameters:
  `entry` - Entry which received new owner.
  `owner` - Owner.
Returns:
  `True` if future cares about this entry.

#### trackable

    public boolean trackable()

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

#### markNotTrackable

    public void markNotTrackable()

Marks this future as non-trackable.

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

#### onNodeLeft

    public boolean onNodeLeft(UUID nodeId)

Callback for when node left.

Specified by:
  `onNodeLeft` in interface `GridCacheFuture<IgniteInternalTx>`
Parameters:
  `nodeId` - Left node ID.
Returns:
  `True` if future cared about this node.

#### onError

    public void onError(Throwable t)

Parameters:
  `t` - Error.

#### onResult

    public void onResult(UUID nodeId,
                GridDhtTxPrepareResponse res)

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

#### onDone

    public boolean onDone(IgniteInternalTx tx0,
                 Throwable err)

Callback to notify that future is finished. Note that if non-`null` exception is passed in the result value will be ignored.

Overrides:
  `onDone` in class `GridFutureAdapter<IgniteInternalTx>`
Parameters:
  `tx0` - Optional result.
  `err` - Optional error.
Returns:
  `True` if result was set by this call.

#### complete

    public void complete()

Completes this future.

#### prepare

    public void prepare(Iterable<IgniteTxEntry> reads,
               Iterable<IgniteTxEntry> writes,
               Map<UUID,Collection<UUID>> txNodes)

Initializes future.

Parameters:
  `reads` - Read entries.
  `writes` - Write entries.
  `txNodes` - Transaction nodes mapping.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridCompoundIdentityFuture<IgniteInternalTx>`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC3
Release Date | : March 24 2015