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

## Class GridDistributedTxPrepareRequest

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

All Implemented Interfaces:
  Serializable, GridCacheDeployable, IgniteTxStateAware, GridCacheVersionable, Message

Direct Known Subclasses:
  GridDhtTxPrepareRequest, GridNearTxPrepareRequest

    public class GridDistributedTxPrepareRequest
    extends GridDistributedBaseMessage
    implements IgniteTxStateAware

Transaction prepare request for optimistic and eventually consistent transactions.

See Also:
  Serialized Form

### Field Summary

Fields
`static int` `QUERY_UPDATE_FLAG_MASK`
`static int` `STORE_WRITE_THROUGH_FLAG_MASK`

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

`ver`

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

`cacheId`

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

`addDepInfo, CACHE_MSG_INDEX_FIELD_NAME, forceAddDepInfo, MAX_CACHE_MSG_LOOKUP_INDEX`

### Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message

`DIRECT_TYPE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`GridDistributedTxPrepareRequest()` Required by `Externalizable`.
`GridDistributedTxPrepareRequest(IgniteInternalTx tx, long timeout, @Nullable Collection<IgniteTxEntry> reads, Collection<IgniteTxEntry> writes, Map<UUID,Collection<UUID>> txNodes, boolean retVal, boolean last, boolean onePhaseCommit, boolean addDepInfo)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `addDeploymentInfo()` Deployment enabled flag indicates whether deployment info has to be added to this message.
`void` `addDhtVersion(IgniteTxKey key, @Nullable GridCacheVersion dhtVer)` Adds version to be verified on remote node.
`TransactionConcurrency` `concurrency()`
`Map<IgniteTxKey,GridCacheVersion>` `dhtVersions()`
`short` `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.
`boolean` `isInvalidate()`
`TransactionIsolation` `isolation()`
`boolean` `last()`
`IgniteLogger` `messageLogger(GridCacheSharedContext ctx)`
`boolean` `needReturnValue()`
`void` `needReturnValue(boolean retVal)`
`boolean` `onePhaseCommit()`
`byte` `policy()`
`void` `prepareMarshal(GridCacheSharedContext ctx)` This method is called before the whole message is serialized and is responsible for pre-marshalling state.
`boolean` `queryUpdate()`
`void` `queryUpdate(boolean queryUpdate)`
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`Collection<IgniteTxEntry>` `reads()`
`protected void` `reads(Collection<IgniteTxEntry> reads)`
`boolean` `storeWriteThrough()`
`void` `storeWriteThrough(boolean storeWriteThrough)`
`boolean` `system()`
`long` `threadId()`
`long` `timeout()`
`String` `toString()`
`Map<UUID,Collection<UUID>>` `transactionNodes()`
`int` `txSize()`
`IgniteTxState` `txState()`
`void` `txState(IgniteTxState txState)`
`Collection<IgniteTxEntry>` `writes()`
`protected void` `writes(Collection<IgniteTxEntry> writes)`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.
`GridCacheVersion` `writeVersion()`

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

`committedVersions, completedVersions, rolledbackVersions, version, version`

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

`cacheGroupMessage, cacheId, cacheId, handlerId`

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

`appendFlag, classError, deployInfo, error, finishUnmarshalCacheObjects, finishUnmarshalCacheObjects, ignoreClassErrors, lastAffinityChangedTopologyVersion, lastAffinityChangedTopologyVersion, lookupIndex, marshalCollection, marshalInfo, marshalInfos, marshalInvokeArguments, marshalTx, messageId, nextIndexId, onAckReceived, onClassError, partition, partitionExchangeMessage, prepare, prepareMarshalCacheObject, prepareMarshalCacheObjects, prepareMarshalCacheObjects, prepareObject, prepareObject, topologyVersion, transferExpiryPolicy, 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`

### Field Detail

#### STORE_WRITE_THROUGH_FLAG_MASK

    public static final int STORE_WRITE_THROUGH_FLAG_MASK

See Also:
  Constant Field Values

#### QUERY_UPDATE_FLAG_MASK

    public static final int QUERY_UPDATE_FLAG_MASK

See Also:
  Constant Field Values

### Constructor Detail

#### GridDistributedTxPrepareRequest

    public GridDistributedTxPrepareRequest()

Required by `Externalizable`.

#### GridDistributedTxPrepareRequest

    public GridDistributedTxPrepareRequest(IgniteInternalTx tx,
                                           long timeout,
                                           @Nullable
                                           @Nullable Collection<IgniteTxEntry> reads,
                                           Collection<IgniteTxEntry> writes,
                                           Map<UUID,Collection<UUID>> txNodes,
                                           boolean retVal,
                                           boolean last,
                                           boolean onePhaseCommit,
                                           boolean addDepInfo)

Parameters:
  `tx` - Cache transaction.
  `timeout` - Transactions timeout.
  `reads` - Read entries.
  `writes` - Write entries.
  `txNodes` - Transaction nodes mapping.
  `retVal` - Return value flag.
  `last` - Last request flag.
  `onePhaseCommit` - One phase commit flag.
  `addDepInfo` - Deployment info flag.

### Method Detail

#### needReturnValue

    public final boolean needReturnValue()

Returns:
  Flag indicating whether transaction needs return value.

#### needReturnValue

    public final void needReturnValue(boolean retVal)

Parameters:
  `retVal` - Need return value.

#### transactionNodes

    public Map<UUID,Collection<UUID>> transactionNodes()

Returns:
  Transaction nodes mapping.

#### system

    public final boolean system()

Returns:
  System flag.

#### storeWriteThrough

    public boolean storeWriteThrough()

Returns:
  Flag indicating whether transaction use cache store.

#### storeWriteThrough

    public void storeWriteThrough(boolean storeWriteThrough)

Parameters:
  `storeWriteThrough` - Store write through value.

#### queryUpdate

    public boolean queryUpdate()

Returns:
  Flag indicating whether it is a query update.

#### queryUpdate

    public void queryUpdate(boolean queryUpdate)

Parameters:
  `queryUpdate` - Query update value.

#### policy

    public byte policy()

Returns:
  IO policy.

#### addDhtVersion

    public void addDhtVersion(IgniteTxKey key,
                              @Nullable
                              @Nullable GridCacheVersion dhtVer)

Adds version to be verified on remote node.

Parameters:
  `key` - Key for which version is verified.
  `dhtVer` - DHT version to check.

#### dhtVersions

    public Map<IgniteTxKey,GridCacheVersion> dhtVersions()

Returns:
  Map of versions to be verified.

#### threadId

    public long threadId()

Returns:
  Thread ID.

#### writeVersion

    public GridCacheVersion writeVersion()

Returns:
  Commit version.

#### isInvalidate

    public boolean isInvalidate()

Returns:
  Invalidate flag.

#### timeout

    public long timeout()

Returns:
  Transaction timeout.

#### concurrency

    public TransactionConcurrency concurrency()

Returns:
  Concurrency.

#### isolation

    public TransactionIsolation isolation()

Returns:
  Isolation level.

#### reads

    public Collection<IgniteTxEntry> reads()

Returns:
  Read set.

#### writes

    public Collection<IgniteTxEntry> writes()

Returns:
  Write entries.

#### reads

    protected void reads(Collection<IgniteTxEntry> reads)

Parameters:
  `reads` - Reads.

#### writes

    protected void writes(Collection<IgniteTxEntry> writes)

Parameters:
  `writes` - Writes.

#### txSize

    public int txSize()

Returns:
  Expected transaction size.

#### onePhaseCommit

    public boolean onePhaseCommit()

Returns:
  One phase commit flag.

#### last

    public boolean last()

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

#### txState

    public IgniteTxState txState()

Specified by:
  `txState` in interface `IgniteTxStateAware`
Returns:
  Transient TX state.

#### txState

    public void txState(IgniteTxState txState)

Specified by:
  `txState` in interface `IgniteTxStateAware`
Parameters:
  `txState` - Transient TX state.

#### 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 `GridCacheMessage`
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 `GridCacheMessage`
Parameters:
  `ctx` - Context.
  `ldr` - Class loader.
Throws:
  `IgniteCheckedException` - If failed.

#### addDeploymentInfo

    public boolean addDeploymentInfo()

Deployment enabled flag indicates whether deployment info has to be added to this message.

Overrides:
  `addDeploymentInfo` in class `GridDistributedBaseMessage`
Returns:
  `true` or if deployment info must be added to the the message, `false` otherwise.

#### messageLogger

    public IgniteLogger messageLogger(GridCacheSharedContext ctx)

Overrides:
  `messageLogger` in class `GridCacheMessage`
Parameters:
  `ctx` - Context.
Returns:
  Logger.

#### 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 `GridDistributedBaseMessage`
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 `GridDistributedBaseMessage`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### directType

    public short directType()

Gets message type.

Specified by:
  `directType` in interface `Message`
Returns:
  Message type.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

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

#### toString

    public String toString()

Overrides:
  `toString` in class `GridDistributedBaseMessage`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020