/** * @param fut Future. */ protected void registrateFutureInMvccManager(GridCacheFuture<?> fut) { if (!trackable) { trackable = true; cctx.mvcc().addFuture(fut, futId); } }
/** * @param fut Future. */ private void registrateFutureInMvccManager(GridCacheFuture<?> fut) { if (!trackable) { trackable = true; cctx.mvcc().addFuture(fut, futId); } }
/** {@inheritDoc} */ @Override public boolean isLockedByThread(K key) { KeyCacheObject cacheKey = ctx.toCacheKeyObject(key); return ctx.mvcc().isLockedByThread(ctx.txKey(cacheKey), Thread.currentThread().getId()); }
/** * @param ver Lock version. * @return {@code True} if removed. */ public boolean addRemoved(GridCacheVersion ver) { assert lockedByCurrentThread(); return cctx.mvcc().addRemoved(cctx, ver); }
/** {@inheritDoc} */ @Override public final boolean onDone(@Nullable Void res, @Nullable Throwable err) { if (super.onDone(res, err)) { cctx.mvcc().removeAtomicFuture(futId); boolean suc = err == null; if (cntQryClsrs != null) { for (CI1<Boolean> clsr : cntQryClsrs) clsr.apply(suc); } return true; } return false; }
/** * */ private void remap() { undoLocks(false, false); for (KeyCacheObject key : GridDhtColocatedLockFuture.this.keys) cctx.mvcc().removeExplicitLock(threadId, cctx.txKey(key), lockVer); mapOnTopology(true, new Runnable() { @Override public void run() { onDone(true); } }); }
/** * @param emptyBefore Empty flag before operation. * @param emptyAfter Empty flag after operation. */ protected void checkCallbacks(boolean emptyBefore, boolean emptyAfter) { assert lockedByCurrentThread(); if (emptyBefore != emptyAfter) { if (emptyBefore) cctx.mvcc().callback().onLocked(this); if (emptyAfter) cctx.mvcc().callback().onFreed(this); } }
/** {@inheritDoc} */ @Override public boolean isLocked(K key) { KeyCacheObject cacheKey = ctx.toCacheKeyObject(key); return ctx.mvcc().isLockedByThread(ctx.txKey(cacheKey), -1); }
/** * @param nodeId Node ID. * @param res Response. */ private void processNearTxEnlistResponse(UUID nodeId, final GridNearTxEnlistResponse res) { GridNearTxEnlistFuture fut = (GridNearTxEnlistFuture) ctx.mvcc().versionedFuture(res.version(), res.futureId()); if (fut != null) fut.onResult(nodeId, res); }
/** * @param nodeId Node ID. * @param res Response. */ private void processNearTxQueryEnlistResponse(UUID nodeId, final GridNearTxQueryEnlistResponse res) { GridNearTxQueryEnlistFuture fut = (GridNearTxQueryEnlistFuture)ctx.mvcc().versionedFuture(res.version(), res.futureId()); if (fut != null) fut.onResult(nodeId, res); }
/** * @param nodeId Node ID. * @param res Response. */ private void processNearTxQueryResultsEnlistResponse(UUID nodeId, final GridNearTxQueryResultsEnlistResponse res) { GridNearTxQueryResultsEnlistFuture fut = (GridNearTxQueryResultsEnlistFuture) ctx.mvcc().versionedFuture(res.version(), res.futureId()); if (fut != null) fut.onResult(nodeId, res); }
/** {@inheritDoc} */ @Override public boolean onDone(Object res, Throwable err) { if (super.onDone(res, err)) { // Don't forget to clean up. if (trackable) cctx.mvcc().removeFuture(futId); cctx.dht().sendTtlUpdateRequest(expiryPlc); return true; } return false; }
/** {@inheritDoc} */ @Override public boolean onDone(Map<K, V> res, Throwable err) { if (super.onDone(res, err)) { if (trackable) cctx.mvcc().removeFuture(futId); cache().sendTtlUpdateRequest(expiryPlc); return true; } return false; }
/** * @param nodeId Node ID. * @param res Response. */ private void processLockResponse(UUID nodeId, GridNearLockResponse res) { assert nodeId != null; assert res != null; GridNearLockFuture fut = (GridNearLockFuture)ctx.mvcc().<Boolean>versionedFuture(res.version(), res.futureId()); if (fut != null) fut.onResult(nodeId, res); }
/** {@inheritDoc} */ @Override public boolean onDone(Map<K, V> res, Throwable err) { if (super.onDone(res, err)) { // Don't forget to clean up. if (trackable) cctx.mvcc().removeFuture(futId); cache().dht().sendTtlUpdateRequest(expiryPlc); return true; } return false; }
/** * @param prev Previous. */ public void leaveNoLock(CacheOperationContext prev) { ctx.tm().resetContext(); ctx.mvcc().contextReset(); // Unwind eviction notifications. CU.unwindEvicts(ctx); // Return back previous thread local operation context per call. ctx.operationContextPerCall(prev); }
/** * @param fut Clears future from cache. */ void onFutureDone(GridLocalLockFuture fut) { if (ctx.mvcc().removeVersionedFuture(fut)) { if (log().isDebugEnabled()) log().debug("Explicitly removed future from map of futures: " + fut); } }
/** * * @param ver Lock version. * @throws GridDistributedLockCancelledException If lock is cancelled. */ protected void checkRemoved(GridCacheVersion ver) throws GridDistributedLockCancelledException { assert lockedByCurrentThread(); GridCacheVersion obsoleteVer = obsoleteVersionExtras(); if ((obsoleteVer != null && obsoleteVer.equals(ver)) || cctx.mvcc().isRemoved(cctx, ver)) throw new GridDistributedLockCancelledException("Lock has been cancelled [key=" + key + ", ver=" + ver + ']'); }
/** * Leave a cache call entered by {@link #enterNoLock} method. */ public void leaveNoLock() { ctx.tm().resetContext(); ctx.mvcc().contextReset(); // Unwind eviction notifications. if (!ctx.shared().closed(ctx)) CU.unwindEvicts(ctx); }
@Override public void run() { for (GridCacheMvccCandidate cand : cands) { boolean b = grid.<String, String>internalCache(DEFAULT_CACHE_NAME).context().mvcc().addNext(ctx, cand); assert b; } info("Link thread finished."); } }, 1);