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

## Class GridDistributedLockResponse

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

All Implemented Interfaces:
  Serializable, GridCacheDeployable, GridCacheVersionable, Message

Direct Known Subclasses:
  GridDhtLockResponse, GridNearLockResponse

    public class GridDistributedLockResponse
    extends GridDistributedBaseMessage

Lock response message.

See Also:
  Serialized Form

### Field Summary

### 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
`GridDistributedLockResponse()` Empty constructor (required by `Externalizable`).
`GridDistributedLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid futId, int cnt)`
`GridDistributedLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid futId, int cnt, Throwable err)`
`GridDistributedLockResponse(int cacheId, GridCacheVersion lockVer, IgniteUuid futId, Throwable err)`

### Method Summary

Methods
`void` `addValue(CacheObject val)`
`byte` `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.
`IgniteUuid` `futureId()`
`boolean` `isCurrentlyLocked(int idx)`
`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.
`void` `setCandidates(int idx, Collection<GridCacheMvccCandidate> cands, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers)`
`String` `toString()`
`CacheObject` `value(int idx)`
`protected int` `valuesSize()`
`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`

### Constructor Detail

#### GridDistributedLockResponse

    public GridDistributedLockResponse()

Empty constructor (required by `Externalizable`).

#### GridDistributedLockResponse

    public GridDistributedLockResponse(int cacheId,
                               GridCacheVersion lockVer,
                               IgniteUuid futId,
                               int cnt)

Parameters:
  `cacheId` - Cache ID.
  `lockVer` - Lock version.
  `futId` - Future ID.
  `cnt` - Key count.

#### GridDistributedLockResponse

    public GridDistributedLockResponse(int cacheId,
                               GridCacheVersion lockVer,
                               IgniteUuid futId,
                               Throwable err)

Parameters:
  `cacheId` - Cache ID.
  `lockVer` - Lock ID.
  `futId` - Future ID.
  `err` - Error.

#### GridDistributedLockResponse

    public GridDistributedLockResponse(int cacheId,
                               GridCacheVersion lockVer,
                               IgniteUuid futId,
                               int cnt,
                               Throwable err)

Parameters:
  `cacheId` - Cache ID.
  `lockVer` - Lock ID.
  `futId` - Future ID.
  `cnt` - Count.
  `err` - Error.

### Method Detail

#### futureId

    public IgniteUuid futureId()

Returns:
  Future ID.

#### error

    public Throwable error()

Returns:
  Error.

#### error

    public void error(Throwable err)

Parameters:
  `err` - Error to set.

#### isCurrentlyLocked

    public boolean isCurrentlyLocked(int idx)

Parameters:
  `idx` - Index of locked flag.
Returns:
  Value of locked flag at given index.

#### setCandidates

    public void setCandidates(int idx,
                     Collection<GridCacheMvccCandidate> cands,
                     Collection<GridCacheVersion> committedVers,
                     Collection<GridCacheVersion> rolledbackVers)

Parameters:
  `idx` - Candidates index.
  `cands` - Collection of candidates.
  `committedVers` - Committed versions relative to lock version.
  `rolledbackVers` - Rolled back versions relative to lock version.

#### addValue

    public void addValue(CacheObject val)

Parameters:
  `val` - Value.

#### valuesSize

    protected int valuesSize()

Returns:
  Values size.

#### value

    @Nullable
    public CacheObject value(int idx)

Parameters:
  `idx` - Index.
Returns:
  Value for given index.

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