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

## Class GridDhtLockFuture

- java.lang.Object
- - org.apache.ignite.internal.util.future.GridFutureAdapter<R>
  - - org.apache.ignite.internal.util.future.GridCompoundFuture<T,T>
    - - org.apache.ignite.internal.util.future.GridCompoundIdentityFuture<T>
      - - org.apache.ignite.internal.processors.cache.GridCacheCompoundIdentityFuture<Boolean>
        - - org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLockFuture

All Implemented Interfaces:
  Serializable, IgniteInternalFuture<Boolean>, DhtLockFuture<Boolean>, GridDhtFuture<Boolean>, GridCacheMappedVersion, GridCacheFuture<Boolean>, GridCacheVersionedFuture<Boolean>, IgniteInClosure<IgniteInternalFuture<Boolean>>

    public final class GridDhtLockFuture
    extends GridCacheCompoundIdentityFuture<Boolean>
    implements GridCacheVersionedFuture<Boolean>, GridDhtFuture<Boolean>, GridCacheMappedVersion, DhtLockFuture<Boolean>

Cache lock future.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`GridDhtLockFuture(GridCacheContext<?,?> cctx, UUID nearNodeId, GridCacheVersion nearLockVer, @NotNull AffinityTopologyVersion topVer, int cnt, boolean read, boolean needReturnVal, long timeout, GridDhtTxLocalAdapter tx, long threadId, long createTtl, long accessTtl, CacheEntryPredicate[] filter, boolean skipStore, boolean keepBinary)`

### Method Summary

All Methods Instance Methods Concrete Methods
`@Nullable GridCacheMvccCandidate` `addEntry(GridDhtCacheEntry entry)` Adds entry to future.
`boolean` `cancel()` Default no-op implementation that always returns `false`.
`Collection<GridDhtCacheEntry>` `entries()`
`IgniteUuid` `futureId()`
`int` `hashCode()`
`Collection<Integer>` `invalidPartitions()` Node that future should be able to provide keys to retry before it completes, so it's not necessary to wait till future is done to get retry keys.
`void` `map()`
`@Nullable GridCacheVersion` `mappedVersion()` Mapping should occur only if this interface returns a non-null value.
`void` `markNotTrackable()` Marks this future as non-trackable.
`GridCacheVersion` `nearLockVersion()`
`boolean` `onDone(@Nullable Boolean success, @Nullable Throwable err)` Callback to notify that future is finished.
`void` `onError(Throwable t)`
`boolean` `onNodeLeft(UUID nodeId)` Callback for when node left.
`boolean` `onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner)` Callback for whenever entry lock ownership changes.
`String` `toString()`
`boolean` `trackable()`
`GridCacheVersion` `version()`

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

`duration, onDone, startTime`

### Methods inherited from class org.apache.ignite.internal.util.future.GridCompoundFuture

`add, apply, clear, future, futures, futuresCountNoLock, hasFutures, hasPending, ignoreFailure, initialized, logDebug, logError, markInitialized, processFailure`

### Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter

`chain, chain, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, logger, onCancelled, onDone, onDone, onDone, reset, result`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheFuture

`duration, startTime`

### Methods inherited from interface org.apache.ignite.internal.IgniteInternalFuture

`chain, chain, error, get, get, get, getUninterruptibly, isCancelled, isDone, listen, result`

### Constructor Detail

#### GridDhtLockFuture

    public GridDhtLockFuture(GridCacheContext<?,?> cctx,
                             UUID nearNodeId,
                             GridCacheVersion nearLockVer,
                             @NotNull
                             @NotNull AffinityTopologyVersion topVer,
                             int cnt,
                             boolean read,
                             boolean needReturnVal,
                             long timeout,
                             GridDhtTxLocalAdapter tx,
                             long threadId,
                             long createTtl,
                             long accessTtl,
                             CacheEntryPredicate[] filter,
                             boolean skipStore,
                             boolean keepBinary)

Parameters:
  `cctx` - Cache context.
  `nearNodeId` - Near node ID.
  `nearLockVer` - Near lock version.
  `topVer` - Topology version.
  `cnt` - Number of keys to lock.
  `read` - Read flag.
  `needReturnVal` - Need return value flag.
  `timeout` - Lock acquisition timeout.
  `tx` - Transaction.
  `threadId` - Thread ID.
  `accessTtl` - TTL for read operation.
  `filter` - Filter.
  `skipStore` - Skip store flag.

### Method Detail

#### invalidPartitions

    public Collection<Integer> invalidPartitions()

Node that future should be able to provide keys to retry before it completes, so it's not necessary to wait till future is done to get retry keys.

Specified by:
  `invalidPartitions` in interface `GridDhtFuture<Boolean>`
Returns:
  Keys to retry because this node is no longer a primary or backup.

#### version

    public GridCacheVersion version()

Specified by:
  `version` in interface `GridCacheVersionedFuture<Boolean>`
Returns:
  Future version.

#### trackable

    public boolean trackable()

Specified by:
  `trackable` in interface `GridCacheFuture<Boolean>`
Returns:
  `True` if future should be tracked.

#### markNotTrackable

    public void markNotTrackable()

Marks this future as non-trackable.

Specified by:
  `markNotTrackable` in interface `GridCacheFuture<Boolean>`

#### entries

    public Collection<GridDhtCacheEntry> entries()

Returns:
  Entries.

#### futureId

    public IgniteUuid futureId()

Specified by:
  `futureId` in interface `GridCacheFuture<Boolean>`
Returns:
  Future ID.

#### nearLockVersion

    public GridCacheVersion nearLockVersion()

Returns:
  Near lock version.

#### mappedVersion

    @Nullable
    public @Nullable GridCacheVersion mappedVersion()

Mapping should occur only if this interface returns a non-null value.

Specified by:
  `mappedVersion` in interface `GridCacheMappedVersion`
Returns:
  Mapped version.

#### addEntry

    @Nullable
    public @Nullable GridCacheMvccCandidate addEntry(GridDhtCacheEntry entry)
                                                        throws GridCacheEntryRemovedException,
                                                               GridDistributedLockCancelledException

Adds entry to future.

Parameters:
  `entry` - Entry to add.
Returns:
  Lock candidate.
Throws:
  `GridCacheEntryRemovedException` - If entry was removed.
  `GridDistributedLockCancelledException` - If lock is canceled.

#### onNodeLeft

    public boolean onNodeLeft(UUID nodeId)

Description copied from interface: `GridCacheFuture`
Callback for when node left.

Specified by:
  `onNodeLeft` in interface `GridCacheFuture<Boolean>`
Parameters:
  `nodeId` - Left node ID
Returns:
  `True` if node was in the list.

#### onError

    public void onError(Throwable t)

Specified by:
  `onError` in interface `DhtLockFuture<Boolean>`
Parameters:
  `t` - Error.

#### onOwnerChanged

    public boolean onOwnerChanged(GridCacheEntryEx entry,
                                  GridCacheMvccCandidate owner)

Callback for whenever entry lock ownership changes.

Specified by:
  `onOwnerChanged` in interface `GridCacheVersionedFuture<Boolean>`
Parameters:
  `entry` - Entry whose lock ownership changed.
  `owner` - Owner.
Returns:
  `True` if future cares about this entry.

#### cancel

    public boolean cancel()

Default no-op implementation that always returns `false`. Futures that do support cancellation should override this method and call `GridFutureAdapter.onCancelled()` callback explicitly if cancellation indeed did happen.

Specified by:
  `cancel` in interface `IgniteInternalFuture<Boolean>`
Overrides:
  `cancel` in class `GridCompoundFuture<Boolean,Boolean>`
Returns:
  `True` if future was canceled (i.e. was not finished prior to this call).

#### onDone

    public boolean onDone(@Nullable
                          @Nullable Boolean success,
                          @Nullable
                          @Nullable Throwable err)

Callback to notify that future is finished. Note that if non-`null` exception is passed in the result value will be ignored.

Overrides:
  `onDone` in class `GridFutureAdapter<Boolean>`
Parameters:
  `success` - Optional result.
  `err` - Optional error.
Returns:
  `True` if result was set by this call.

#### map

    public void map()

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `GridCompoundIdentityFuture<Boolean>`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.11.1
Release Date | : December 20 2021