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

## Class GridDistributedTxPrepareResponse

- 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.GridDistributedTxPrepareResponse

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

Direct Known Subclasses:
  GridDhtTxPrepareResponse, GridNearTxPrepareResponse

    public class GridDistributedTxPrepareResponse
    extends GridDistributedBaseMessage
    implements IgniteTxStateAware

Response to prepare request.

See Also:
  Serialized Form

### Field Summary

Fields
`protected byte` `flags`

### 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
`GridDistributedTxPrepareResponse()` Empty constructor (required by `Externalizable`).
`GridDistributedTxPrepareResponse(int part, GridCacheVersion xid, boolean addDepInfo)`
`GridDistributedTxPrepareResponse(int part, GridCacheVersion xid, Throwable err, boolean addDepInfo)`

### Method Summary

Methods
`short` `directType()` Gets message type.
`Throwable` `error()`
`void` `error(Throwable err)`
`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.
`protected boolean` `isFlag(int mask)` Reags flag mask.
`boolean` `isRollback()`
`IgniteLogger` `messageLogger(GridCacheSharedContext ctx)`
`int` `partition()`
`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.
`protected void` `setFlag(boolean flag, int mask)` Sets flag mask.
`String` `toString()`
`IgniteTxState` `txState()`
`void` `txState(IgniteTxState txState)`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

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

`addDeploymentInfo, 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, finishUnmarshalCacheObjects, finishUnmarshalCacheObjects, ignoreClassErrors, lookupIndex, marshalCollection, marshalInfo, marshalInfos, marshalInvokeArguments, marshalTx, messageId, nextIndexId, onAckReceived, onClassError, 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

#### flags

    protected byte flags

### Constructor Detail

#### GridDistributedTxPrepareResponse

    public GridDistributedTxPrepareResponse()

Empty constructor (required by `Externalizable`).

#### GridDistributedTxPrepareResponse

    public GridDistributedTxPrepareResponse(int part,
                                    GridCacheVersion xid,
                                    boolean addDepInfo)

Parameters:
  `part` - Partition.
  `xid` - Lock or transaction ID.
  `addDepInfo` - Deployment info flag.

#### GridDistributedTxPrepareResponse

    public GridDistributedTxPrepareResponse(int part,
                                    GridCacheVersion xid,
                                    Throwable err,
                                    boolean addDepInfo)

Parameters:
  `part` - Partition.
  `xid` - Lock or transaction ID.
  `err` - Error.
  `addDepInfo` - Deployment info flag.

### Method Detail

#### setFlag

    protected final void setFlag(boolean flag,
               int mask)

Sets flag mask.

Parameters:
  `flag` - Set or clear.
  `mask` - Mask.

#### isFlag

    protected final boolean isFlag(int mask)

Reags flag mask.

Parameters:
  `mask` - Mask to read.
Returns:
  Flag value.

#### partition

    public int partition()

Overrides:
  `partition` in class `GridCacheMessage`
Returns:
  Partition ID this message is targeted to or `-1` if it cannot be determined.

#### error

    public Throwable error()

Overrides:
  `error` in class `GridCacheMessage`
Returns:
  Error, if any.

#### error

    public void error(Throwable err)

Parameters:
  `err` - Error to set.

#### isRollback

    public boolean isRollback()

Returns:
  Rollback flag.

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

#### messageLogger

    public IgniteLogger messageLogger(GridCacheSharedContext ctx)

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

#### 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` - Cache context.
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.

#### 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`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017