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>,GridDhtFuture<Boolean>,GridCacheMappedVersion,GridCacheFuture<Boolean>,GridCacheVersionedFuture<Boolean>,IgniteInClosure<IgniteInternalFuture<Boolean>>
public final class GridDhtLockFuture extends GridCacheCompoundIdentityFuture<Boolean> implements GridCacheVersionedFuture<Boolean>, GridDhtFuture<Boolean>, GridCacheMappedVersion
Cache lock future.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor 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, boolean skipStore, boolean keepBinary)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable GridCacheMvccCandidateaddEntry(GridDhtCacheEntry entry)Adds entry to future.booleancancel()Default no-op implementation that always returnsfalse.Collection<GridDhtCacheEntry>entries()IgniteUuidfutureId()inthashCode()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.voidmap()@Nullable GridCacheVersionmappedVersion()Mapping should occur only if this interface returns a non-null value.voidmarkNotTrackable()Marks this future as non-trackable.GridCacheVersionnearLockVersion()booleanonDone(@Nullable Boolean success, @Nullable Throwable err)Callback to notify that future is finished.voidonError(Throwable t)booleanonNodeLeft(UUID nodeId)Callback for when node left.booleanonOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner)Callback for whenever entry lock ownership changes.StringtoString()booleantrackable()GridCacheVersionversion()-
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, compoundsLockedExclusively, compoundsReadLock, compoundsReadUnlock, future, futures, futuresCountNoLock, hasFutures, hasPending, ignoreFailure, initialized, logDebug, logError, markInitialized, processFailure
-
Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter
chain, chain, chain, chain, chainCompose, chainCompose, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, 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, chain, chain, chainCompose, chainCompose, error, get, get, get, getUninterruptibly, isCancelled, isDone, listen, 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, 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.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:
invalidPartitionsin interfaceGridDhtFuture<Boolean>- Returns:
- Keys to retry because this node is no longer a primary or backup.
-
version
public GridCacheVersion version()
- Specified by:
versionin interfaceGridCacheVersionedFuture<Boolean>- Returns:
- Future version.
-
trackable
public boolean trackable()
- Specified by:
trackablein interfaceGridCacheFuture<Boolean>- Returns:
Trueif future should be tracked.
-
markNotTrackable
public void markNotTrackable()
Marks this future as non-trackable.- Specified by:
markNotTrackablein interfaceGridCacheFuture<Boolean>
-
entries
public Collection<GridDhtCacheEntry> entries()
- Returns:
- Entries.
-
futureId
public IgniteUuid futureId()
- Specified by:
futureIdin interfaceGridCacheFuture<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:
mappedVersionin interfaceGridCacheMappedVersion- 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:GridCacheFutureCallback for when node left.- Specified by:
onNodeLeftin interfaceGridCacheFuture<Boolean>- Parameters:
nodeId- Left node ID- Returns:
Trueif node was in the list.
-
onError
public void onError(Throwable t)
- Parameters:
t- Error.
-
onOwnerChanged
public boolean onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner)
Callback for whenever entry lock ownership changes.- Specified by:
onOwnerChangedin interfaceGridCacheVersionedFuture<Boolean>- Parameters:
entry- Entry whose lock ownership changed.owner- Owner.- Returns:
Trueif future cares about this entry.
-
cancel
public boolean cancel()
Default no-op implementation that always returnsfalse. Futures that do support cancellation should override this method and callGridFutureAdapter.onCancelled()callback explicitly if cancellation indeed did happen.- Specified by:
cancelin interfaceIgniteInternalFuture<Boolean>- Overrides:
cancelin classGridCompoundFuture<Boolean,Boolean>- Returns:
Trueif 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-nullexception is passed in the result value will be ignored.- Overrides:
onDonein classGridFutureAdapter<Boolean>- Parameters:
success- Optional result.err- Optional error.- Returns:
Trueif result was set by this call.
-
map
public void map()
-
toString
public String toString()
- Overrides:
toStringin classGridCompoundIdentityFuture<Boolean>
-
-