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

`CACHE_MSG_INDEX_FIELD_NAME, cacheId, MAX_CACHE_MSG_LOOKUP_INDEX`

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

### Method Summary

Methods
`void` `addKeyBytes(KeyCacheObject key, boolean retVal, Collection<GridCacheMvccCandidate> cands, GridCacheContext ctx)` Adds a key.
`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` `inTx()`
`boolean` `isInvalidate()`
`TransactionIsolation` `isolation()`
`List<KeyCacheObject>` `keys()`
`GridCacheVersion` `nearXidVersion()`
`UUID` `nodeId()`
`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[]` `returnFlags()`
`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

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

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

`allowForStartup, cacheId, cacheId, classError, deployInfo, finishUnmarshalCacheObjects, finishUnmarshalCacheObjects, ignoreClassErrors, lookupIndex, marshalCollection, marshalInfo, marshalInfos, marshalInvokeArguments, marshalTx, messageId, nextIndexId, onClassError, partitionExchangeMessage, prepare, 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)

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.

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

#### returnFlags

    public boolean[] returnFlags()

Returns:
  Return flags.

#### skipStore

    public boolean skipStore()

Returns:
  Skip store flag.

#### 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,
                   @Nullable
                   Collection<GridCacheMvccCandidate> cands,
                   GridCacheContext ctx)
                     throws IgniteCheckedException

Adds a key.

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

#### keys

    public List<KeyCacheObject> keys()

Returns:
  Unmarshalled keys.

#### timeout

    public long timeout()

Returns:
  Max lock wait time.

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

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.3.0-incubating
Release Date | : July 10 2015