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

## Class GridDhtTxPrepareRequest

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheMessage
  - - org.apache.ignite.internal.processors.cache.distributed.GridDistributedBaseMessage
    - - org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest
      - - org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareRequest

All Implemented Interfaces:
  Serializable, GridCacheDeployable, GridCacheVersionable, Message

    public class GridDhtTxPrepareRequest
    extends GridDistributedTxPrepareRequest

DHT prepare request.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedBaseMessage

`ver`

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

`CACHE_MSG_INDEX_FIELD_NAME, cacheId, MAX_CACHE_MSG_LOOKUP_INDEX`

### Constructor Summary

Constructors
Constructor and Description
`GridDhtTxPrepareRequest()` Empty constructor required for `Externalizable`.
`GridDhtTxPrepareRequest(IgniteUuid futId, IgniteUuid miniId, AffinityTopologyVersion topVer, GridDhtTxLocalAdapter tx, Collection<IgniteTxEntry> dhtWrites, Collection<IgniteTxEntry> nearWrites, IgniteTxKey grpLockKey, boolean partLock, Map<UUID,Collection<UUID>> txNodes, GridCacheVersion nearXidVer, boolean last, boolean onePhaseCommit, UUID subjId, int taskNameHash)`

### Method Summary

Methods
`boolean` `allowForStartup()`
`byte` `directType()` Gets message type.
`byte` `fieldsCount()` Gets fields count.
`void` `finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr)` This method is called after the message is deserialized and is responsible for unmarshalling state marshalled in `GridCacheMessage.prepareMarshal(GridCacheSharedContext)` method.
`IgniteUuid` `futureId()`
`boolean` `invalidateNearEntry(int idx)`
`void` `invalidateNearEntry(int idx, boolean invalidate)`
`boolean` `last()`
`void` `markKeyForPreload(int idx)` Marks last added key for preloading.
`IgniteUuid` `miniId()`
`UUID` `nearNodeId()`
`Collection<IgniteTxEntry>` `nearWrites()`
`GridCacheVersion` `nearXidVersion()`
`boolean` `needPreloadKey(int idx)` Checks whether entry info should be sent to primary node from backup.
`Map<IgniteTxKey,GridCacheVersion>` `owned()`
`void` `owned(IgniteTxKey key, GridCacheVersion ownerMapped)` Sets owner and its mapped version.
`void` `prepareMarshal(GridCacheSharedContext ctx)` This method is called before the whole message is serialized and is responsible for pre-marshalling state.
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`UUID` `subjectId()`
`int` `taskNameHash()`
`AffinityTopologyVersion` `topologyVersion()` Gets topology version or -1 in case of topology version is not required for this message.
`String` `toString()`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

### Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxPrepareRequest

`addDhtVersion, concurrency, dhtVersions, groupLockKey, isInvalidate, isolation, onePhaseCommit, partitionLock, policy, reads, reads, system, threadId, timeout, transactionNodes, txSize, writes, writes, writeVersion`

### Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedBaseMessage

`candidatesByIndex, candidatesByIndex, candidatesByKey, candidatesByKey, candidatesByKey, committedVersions, completedVersions, keysCount, rolledbackVersions, version, version`

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

`cacheId, cacheId, classError, deployInfo, finishUnmarshalCacheObjects, finishUnmarshalCacheObjects, ignoreClassErrors, lookupIndex, marshalBooleanLinkedMap, marshalCollection, marshalInfo, marshalInfos, marshalInvokeArguments, marshalTx, messageId, nextIndexId, onClassError, prepare, prepareMarshalCacheObjects, prepareMarshalCacheObjects, prepareObject, transferExpiryPolicy, unmarshalBooleanLinkedMap, unmarshalCollection, unmarshalInfo, unmarshalInfos, unmarshalInvokeArguments, unmarshalTx`

### 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.GridCacheDeployable

`deployInfo, prepare`

### Constructor Detail

#### GridDhtTxPrepareRequest

    public GridDhtTxPrepareRequest()

Empty constructor required for `Externalizable`.

#### GridDhtTxPrepareRequest

    public GridDhtTxPrepareRequest(IgniteUuid futId,
                           IgniteUuid miniId,
                           AffinityTopologyVersion topVer,
                           GridDhtTxLocalAdapter tx,
                           Collection<IgniteTxEntry> dhtWrites,
                           Collection<IgniteTxEntry> nearWrites,
                           IgniteTxKey grpLockKey,
                           boolean partLock,
                           Map<UUID,Collection<UUID>> txNodes,
                           GridCacheVersion nearXidVer,
                           boolean last,
                           boolean onePhaseCommit,
                           UUID subjId,
                           int taskNameHash)

Parameters:
  `futId` - Future ID.
  `miniId` - Mini future ID.
  `topVer` - Topology version.
  `tx` - Transaction.
  `dhtWrites` - DHT writes.
  `nearWrites` - Near writes.
  `grpLockKey` - Group lock key if preparing group-lock transaction.
  `partLock` - `True` if group-lock transaction locks partition.
  `txNodes` - Transaction nodes mapping.
  `nearXidVer` - Near transaction ID.
  `last` - `True` if this is last prepare request for node.
  `onePhaseCommit` - One phase commit flag.

### Method Detail

#### last

    public boolean last()

Returns:
  `True` if this is last prepare request for node.

#### nearXidVersion

    public GridCacheVersion nearXidVersion()

Returns:
  Near transaction ID.

#### allowForStartup

    public boolean allowForStartup()

Overrides:
  `allowForStartup` in class `GridCacheMessage`
Returns:
  `True` if this message is preloader message.

#### nearNodeId

    public UUID nearNodeId()

Returns:
  Near node ID.

#### subjectId

    @Nullable
    public UUID subjectId()

Returns:
  Subject ID.

#### taskNameHash

    public int taskNameHash()

Returns:
  Task name hash.

#### nearWrites

    public Collection<IgniteTxEntry> nearWrites()

Returns:
  Near writes.

#### invalidateNearEntry

    public void invalidateNearEntry(int idx,
                           boolean invalidate)

Parameters:
  `idx` - Entry index to set invalidation flag.
  `invalidate` - Invalidation flag value.

#### invalidateNearEntry

    public boolean invalidateNearEntry(int idx)

Parameters:
  `idx` - Index to get invalidation flag value.
Returns:
  Invalidation flag value.

#### markKeyForPreload

    public void markKeyForPreload(int idx)

Marks last added key for preloading.

#### needPreloadKey

    public boolean needPreloadKey(int idx)

Checks whether entry info should be sent to primary node from backup.

Parameters:
  `idx` - Index.
Returns:
  `True` if value should be sent, `false` otherwise.

#### futureId

    public IgniteUuid futureId()

Returns:
  Future ID.

#### miniId

    public IgniteUuid miniId()

Returns:
  Mini future ID.

#### topologyVersion

    public AffinityTopologyVersion topologyVersion()

Description copied from class: `GridCacheMessage`
Gets topology version or -1 in case of topology version is not required for this message.

Overrides:
  `topologyVersion` in class `GridCacheMessage`
Returns:
  Topology version.

#### owned

    public void owned(IgniteTxKey key,
             GridCacheVersion ownerMapped)

Sets owner and its mapped version.

Parameters:
  `key` - Key.
  `ownerMapped` - Owner mapped version.

#### owned

    public Map<IgniteTxKey,GridCacheVersion> owned()

Returns:
  Owned versions map.

#### prepareMarshal

    public void prepareMarshal(GridCacheSharedContext ctx)
                        throws IgniteCheckedException

This method is called before the whole message is serialized and is responsible for pre-marshalling state.

Overrides:
  `prepareMarshal` in class `GridDistributedTxPrepareRequest`
Parameters:
  `ctx` -
Throws:
  `IgniteCheckedException` - If failed.

#### finishUnmarshal

    public void finishUnmarshal(GridCacheSharedContext ctx,
                       ClassLoader ldr)
                         throws IgniteCheckedException

This method is called after the message is deserialized and is responsible for unmarshalling state marshalled in `GridCacheMessage.prepareMarshal(GridCacheSharedContext)` method.

Overrides:
  `finishUnmarshal` in class `GridDistributedTxPrepareRequest`
Parameters:
  `ctx` - Context.
  `ldr` - Class loader.
Throws:
  `IgniteCheckedException` - If failed.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridDistributedTxPrepareRequest`

#### writeTo

    public boolean writeTo(ByteBuffer buf,
                  MessageWriter writer)

Writes this message to provided byte buffer.

Specified by:
  `writeTo` in interface `Message`
Overrides:
  `writeTo` in class `GridDistributedTxPrepareRequest`
Parameters:
  `buf` - Byte buffer.
  `writer` - Writer.
Returns:
  Whether message was fully written.

#### readFrom

    public boolean readFrom(ByteBuffer buf,
                   MessageReader reader)

Reads this message from provided byte buffer.

Specified by:
  `readFrom` in interface `Message`
Overrides:
  `readFrom` in class `GridDistributedTxPrepareRequest`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### directType

    public byte directType()

Gets message type.

Specified by:
  `directType` in interface `Message`
Overrides:
  `directType` in class `GridDistributedTxPrepareRequest`
Returns:
  Message type.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

Specified by:
  `fieldsCount` in interface `Message`
Overrides:
  `fieldsCount` in class `GridDistributedTxPrepareRequest`
Returns:
  Fields count.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0
Release Date | : March 31 2015