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

## Class GridDistributedLockRequest

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

All Implemented Interfaces:
  Serializable, GridCacheDeployable, GridCacheVersionable, Message

Direct Known Subclasses:
  GridDhtLockRequest, GridNearLockRequest

    public class GridDistributedLockRequest
    extends GridDistributedBaseMessage

Lock request message.

See Also:
  Serialized Form

### Field Summary

Fields
`protected int` `idx` Key-bytes index.

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

`ver`

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

`addDepInfo, CACHE_MSG_INDEX_FIELD_NAME, cacheId, 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
`GridDistributedLockRequest()` Empty constructor.
`GridDistributedLockRequest(int cacheId, UUID nodeId, GridCacheVersion nearXidVer, long threadId, IgniteUuid futId, GridCacheVersion lockVer, boolean isInTx, boolean isRead, TransactionIsolation isolation, boolean isInvalidate, long timeout, int keyCnt, int txSize, boolean skipStore, boolean keepBinary, boolean addDepInfo)`

### Method Summary

Methods
`void` `addKeyBytes(KeyCacheObject key, boolean retVal, GridCacheContext ctx)` Adds a key.
`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.
`IgniteUuid` `futureId()`
`boolean` `inTx()`
`boolean` `isInvalidate()`
`TransactionIsolation` `isolation()`
`boolean` `keepBinary()`
`void` `keepBinary(boolean keepBinary)`
`List<KeyCacheObject>` `keys()`
`IgniteLogger` `messageLogger(GridCacheSharedContext ctx)`
`GridCacheVersion` `nearXidVersion()`
`UUID` `nodeId()`
`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.
`boolean` `returnValue(int idx)`
`boolean` `skipStore()`
`long` `threadId()`
`long` `timeout()`
`String` `toString()`
`boolean` `txRead()`
`int` `txSize()`
`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.GridCacheMessage

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

#### idx

    protected int idx

Key-bytes index.

### Constructor Detail

#### GridDistributedLockRequest

    public GridDistributedLockRequest()

Empty constructor.

#### GridDistributedLockRequest

    public GridDistributedLockRequest(int cacheId,
                              UUID nodeId,
                              @Nullable
                              GridCacheVersion nearXidVer,
                              long threadId,
                              IgniteUuid futId,
                              GridCacheVersion lockVer,
                              boolean isInTx,
                              boolean isRead,
                              TransactionIsolation isolation,
                              boolean isInvalidate,
                              long timeout,
                              int keyCnt,
                              int txSize,
                              boolean skipStore,
                              boolean keepBinary,
                              boolean addDepInfo)

Parameters:
  `cacheId` - Cache ID.
  `nodeId` - Node ID.
  `nearXidVer` - Near transaction ID.
  `threadId` - Thread ID.
  `futId` - Future ID.
  `lockVer` - Cache version.
  `isInTx` - `True` if implicit transaction lock.
  `isRead` - Indicates whether implicit lock is for read or write operation.
  `isolation` - Transaction isolation.
  `isInvalidate` - Invalidation flag.
  `timeout` - Lock timeout.
  `keyCnt` - Number of keys.
  `txSize` - Expected transaction size.
  `skipStore` - Skip store flag.
  `addDepInfo` - Deployment info flag.

### Method Detail

#### nodeId

    public UUID nodeId()

Returns:
  Node ID.

#### nearXidVersion

    public GridCacheVersion nearXidVersion()

Returns:
  Near transaction ID.

#### threadId

    public long threadId()

Returns:
  Owner node thread ID.

#### futureId

    public IgniteUuid futureId()

Returns:
  Future ID.

#### inTx

    public boolean inTx()

Returns:
  `True` if implicit transaction lock.

#### isInvalidate

    public boolean isInvalidate()

Returns:
  Invalidate flag.

#### txRead

    public boolean txRead()

Returns:
  `True` if lock is implicit and for a read operation.

#### returnValue

    public boolean returnValue(int idx)

Parameters:
  `idx` - Key index.
Returns:
  Flag indicating whether a value should be returned.

#### skipStore

    public boolean skipStore()

Returns:
  Skip store flag.

#### keepBinary

    public void keepBinary(boolean keepBinary)

Parameters:
  `keepBinary` - Keep binary flag.

#### keepBinary

    public boolean keepBinary()

Returns:
  Keep binary.

#### isolation

    public TransactionIsolation isolation()

Returns:
  Transaction isolation or `null` if not in transaction.

#### txSize

    public int txSize()

Returns:
  Tx size.

#### addKeyBytes

    public void addKeyBytes(KeyCacheObject key,
                   boolean retVal,
                   GridCacheContext ctx)
                     throws IgniteCheckedException

Adds a key.

Parameters:
  `key` - Key.
  `retVal` - Flag indicating whether value should be returned.
  `ctx` - Context.
Throws:
  `IgniteCheckedException` - If failed.

#### keys

    public List<KeyCacheObject> keys()

Returns:
  Unmarshalled keys.

#### partition

    public int partition()

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

#### timeout

    public long timeout()

Returns:
  Max lock wait time.

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

Returns:
  Message type.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

Returns:
  Fields count.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridDistributedBaseMessage`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017