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

## Class GridNearLockRequest<K,V>

- java.lang.Object
- - org.apache.ignite.plugin.extensions.communication.MessageAdapter
  - - org.apache.ignite.internal.processors.cache.GridCacheMessage<K,V>
    - - org.apache.ignite.internal.processors.cache.distributed.GridDistributedBaseMessage<K,V>
      - - org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockRequest<K,V>
        - - org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest<K,V>

All Implemented Interfaces:
  Serializable, GridCacheDeployable, GridCacheVersionable

    public class GridNearLockRequest<K,V>
    extends GridDistributedLockRequest<K,V>

Near cache lock request.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.plugin.extensions.communication.MessageAdapter

`MessageAdapter.Type`

### Field Summary

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

`idx`

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

### Fields inherited from class org.apache.ignite.plugin.extensions.communication.MessageAdapter

`reader, readState`

### Constructor Summary

Constructors
Constructor and Description
`GridNearLockRequest()` Empty constructor required for `Externalizable`.
`GridNearLockRequest(int cacheId, long topVer, UUID nodeId, long threadId, IgniteUuid futId, GridCacheVersion lockVer, boolean isInTx, boolean implicitTx, boolean implicitSingleTx, boolean isRead, TransactionIsolation isolation, boolean isInvalidate, long timeout, int keyCnt, int txSize, boolean syncCommit, IgniteTxKey grpLockKey, boolean partLock, UUID subjId, int taskNameHash, long accessTtl)`

### Method Summary

Methods
`long` `accessTtl()`
`void` `addKeyBytes(K key, byte[] keyBytes, boolean retVal, GridCacheVersion dhtVer, GridCacheContext<K,V> ctx)` Adds a key.
`GridCacheVersion` `dhtVersion(int idx)`
`byte` `directType()` Gets message type.
`IgnitePredicate<javax.cache.Cache.Entry<K,V>>[]` `filter()`
`void` `filter(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter, GridCacheContext<K,V> ctx)`
`void` `finishUnmarshal(GridCacheSharedContext<K,V> 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` `hasTransforms()`
`void` `hasTransforms(boolean hasTransforms)`
`boolean` `implicitSingleTx()`
`boolean` `implicitTx()`
`IgniteUuid` `miniId()`
`void` `miniId(IgniteUuid miniId)`
`boolean` `onePhaseCommit()`
`void` `onePhaseCommit(boolean onePhaseCommit)`
`void` `prepareMarshal(GridCacheSharedContext<K,V> ctx)` This method is called before the whole message is serialized and is responsible for pre-marshalling state.
`boolean` `readFrom(ByteBuffer buf)` Reads this message from provided byte buffer.
`UUID` `subjectId()`
`boolean` `syncCommit()`
`int` `taskNameHash()`
`long` `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.GridDistributedLockRequest

`addKeyBytes, futureId, groupLock, groupLockKey, inTx, isInvalidate, isolation, keyBytes, keys, nearXidVersion, nodeId, partitionLock, returnFlags, returnValue, threadId, timeout, txRead, txSize`

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

`allowForStartup, cacheId, cacheId, classError, deployInfo, ignoreClassErrors, lookupIndex, marshalBooleanLinkedMap, marshalCollection, marshalFilter, marshalInfo, marshalInfos, marshalInvokeArguments, marshalTx, marshalValuesCollection, messageId, nextIndexId, onClassError, prepare, prepareFilter, prepareObject, prepareObjects, transactional, transferExpiryPolicy, unmarshalBooleanLinkedMap, unmarshalCollection, unmarshalFilter, unmarshalInfo, unmarshalInfos, unmarshalInvokeArguments, unmarshalTx, unmarshalValueBytesCollection`

### Methods inherited from class org.apache.ignite.plugin.extensions.communication.MessageAdapter

`setReader, skipRecovery`

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

#### GridNearLockRequest

    public GridNearLockRequest()

Empty constructor required for `Externalizable`.

#### GridNearLockRequest

    public GridNearLockRequest(int cacheId,
                       long topVer,
                       UUID nodeId,
                       long threadId,
                       IgniteUuid futId,
                       GridCacheVersion lockVer,
                       boolean isInTx,
                       boolean implicitTx,
                       boolean implicitSingleTx,
                       boolean isRead,
                       TransactionIsolation isolation,
                       boolean isInvalidate,
                       long timeout,
                       int keyCnt,
                       int txSize,
                       boolean syncCommit,
                       @Nullable
                       IgniteTxKey grpLockKey,
                       boolean partLock,
                       @Nullable
                       UUID subjId,
                       int taskNameHash,
                       long accessTtl)

Parameters:
  `cacheId` - Cache ID.
  `topVer` - Topology version.
  `nodeId` - Node ID.
  `threadId` - Thread ID.
  `futId` - Future ID.
  `lockVer` - Cache version.
  `isInTx` - `True` if implicit transaction lock.
  `implicitTx` - Flag to indicate that transaction is implicit.
  `implicitSingleTx` - Implicit-transaction-with-one-key flag.
  `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.
  `syncCommit` - Synchronous commit flag.
  `grpLockKey` - Group lock key if this is a group-lock transaction.
  `partLock` - If partition is locked.
  `subjId` - Subject ID.
  `taskNameHash` - Task name hash code.
  `accessTtl` - TTL for read operation.

### Method Detail

#### topologyVersion

    public long 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<K,V>`
Returns:
  Topology version.

#### subjectId

    public UUID subjectId()

Returns:
  Subject ID.

#### taskNameHash

    public int taskNameHash()

Returns:
  Task name hash.q

#### implicitTx

    public boolean implicitTx()

Returns:
  Implicit transaction flag.

#### implicitSingleTx

    public boolean implicitSingleTx()

Returns:
  Implicit-transaction-with-one-key flag.

#### onePhaseCommit

    public boolean onePhaseCommit()

Returns:
  One phase commit flag.

#### onePhaseCommit

    public void onePhaseCommit(boolean onePhaseCommit)

Parameters:
  `onePhaseCommit` - One phase commit flag.

#### syncCommit

    public boolean syncCommit()

Returns:
  Sync commit flag.

#### filter

    public IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter()

Returns:
  Filter.

#### filter

    public void filter(IgnitePredicate<javax.cache.Cache.Entry<K,V>>[] filter,
              GridCacheContext<K,V> ctx)
                throws IgniteCheckedException

Parameters:
  `filter` - Filter.
  `ctx` - Context.
Throws:
  `IgniteCheckedException` - If failed.

#### miniId

    public IgniteUuid miniId()

Returns:
  Mini future ID.

#### miniId

    public void miniId(IgniteUuid miniId)

Parameters:
  `miniId` - Mini future Id.

#### hasTransforms

    public void hasTransforms(boolean hasTransforms)

Parameters:
  `hasTransforms` - `True` if originating transaction has transform entries.

#### hasTransforms

    public boolean hasTransforms()

Returns:
  `True` if originating transaction has transform entries.

#### addKeyBytes

    public void addKeyBytes(K key,
                   byte[] keyBytes,
                   boolean retVal,
                   @Nullable
                   GridCacheVersion dhtVer,
                   GridCacheContext<K,V> ctx)
                     throws IgniteCheckedException

Adds a key.

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

#### dhtVersion

    public GridCacheVersion dhtVersion(int idx)

Parameters:
  `idx` - Index of the key.
Returns:
  DHT version for key at given index.

#### accessTtl

    public long accessTtl()

Returns:
  TTL for read operation.

#### prepareMarshal

    public void prepareMarshal(GridCacheSharedContext<K,V> ctx)
                        throws IgniteCheckedException

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

Overrides:
  `prepareMarshal` in class `GridDistributedLockRequest<K,V>`
Parameters:
  `ctx` - Cache context.
Throws:
  `IgniteCheckedException` - If failed.

#### finishUnmarshal

    public void finishUnmarshal(GridCacheSharedContext<K,V> 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 `GridDistributedLockRequest<K,V>`
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.

Overrides:
  `writeTo` in class `GridDistributedLockRequest<K,V>`
Parameters:
  `buf` - Byte buffer.
  `writer` - Writer.
Returns:
  Whether message was fully written.

#### readFrom

    public boolean readFrom(ByteBuffer buf)

Reads this message from provided byte buffer.

Overrides:
  `readFrom` in class `GridDistributedLockRequest<K,V>`
Parameters:
  `buf` - Byte buffer.
Returns:
  Whether message was fully read.

#### directType

    public byte directType()

Gets message type.

Overrides:
  `directType` in class `GridDistributedLockRequest<K,V>`
Returns:
  Message type.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridDistributedLockRequest<K,V>`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015