/** {@inheritDoc} */ @Override public boolean onDone(Collection<R> res, Throwable err) { cctx.time().removeTimeoutObject(this); return super.onDone(res, err); }
/** {@inheritDoc} */ @Override public boolean onDone(@Nullable Long res, @Nullable Throwable err, boolean cancelled) { if (!DONE_UPD.compareAndSet(this, 0, 1)) return false; cctx.tm().resetContext(); Throwable ex0 = ex; if (ex0 != null) { if (err != null) ex0.addSuppressed(err); err = ex0; } if (!cancelled && err == null) tx.clearLockFuture(this); else tx.setRollbackOnly(); boolean done = super.onDone(res, err, cancelled); assert done; // Clean up. cctx.mvcc().removeVersionedFuture(this); if (timeoutObj != null) cctx.time().removeTimeoutObject(timeoutObj); return true; }
/** {@inheritDoc} */ @Override public boolean onDone(@Nullable T res, @Nullable Throwable err) { assert res != null || err != null; if (!DONE_UPD.compareAndSet(this, 0, 1)) return false; if (err == null) clearLockFuture(); // To prevent new remote transactions creation // after future is cancelled by rollback. synchronized (this) { boolean done = super.onDone(res, err); assert done; if (log.isDebugEnabled()) log.debug("Completing future: " + this); // Clean up. cctx.mvcc().removeFuture(futId); if (timeoutObj != null) cctx.time().removeTimeoutObject(timeoutObj); U.close(it, log); return true; } }
/** * */ public void map() { if (F.isEmpty(entries)) { onComplete(true, false, true); return; } readyLocks(); if (timeout > 0 && !isDone()) { // Prevent memory leak if future is completed by call to readyLocks. timeoutObj = new LockTimeoutObject(); cctx.time().addTimeoutObject(timeoutObj); } }
/** * @param part Partition. * @param primaryId Primary ID. * @param futId Future ID. */ private void sendDeferredUpdateResponse(int part, UUID primaryId, long futId) { Map<UUID, GridDhtAtomicDeferredUpdateResponse> resMap = defRes.get(); GridDhtAtomicDeferredUpdateResponse msg = resMap.get(primaryId); if (msg == null) { msg = new GridDhtAtomicDeferredUpdateResponse(ctx.cacheId(), new GridLongList(DEFERRED_UPDATE_RESPONSE_BUFFER_SIZE)); if (DEFERRED_UPDATE_RESPONSE_TIMEOUT > 0) { GridTimeoutObject timeoutSnd = new DeferredUpdateTimeout(part, primaryId); msg.timeoutSender(timeoutSnd); ctx.time().addTimeoutObject(timeoutSnd); } resMap.put(primaryId, msg); } GridLongList futIds = msg.futureIds(); assert futIds.size() < DEFERRED_UPDATE_RESPONSE_BUFFER_SIZE : futIds.size(); futIds.add(futId); if (futIds.size() >= DEFERRED_UPDATE_RESPONSE_BUFFER_SIZE) { resMap.remove(primaryId); sendDeferredUpdateResponse(primaryId, msg); } }
cctx.time().removeTimeoutObject(timeoutObj);
/** * @param cctx Context. * @param qry Query. * @param loc Local query or not. */ protected GridCacheQueryFutureAdapter(GridCacheContext<K, V> cctx, GridCacheQueryBean qry, boolean loc) { this.cctx = cctx; this.qry = qry; this.loc = loc; if (log == null) log = U.logger(cctx.kernalContext(), logRef, GridCacheQueryFutureAdapter.class); startTime = U.currentTimeMillis(); long timeout = qry.query().timeout(); if (timeout > 0) { endTime = startTime + timeout; // Protect against overflow. if (endTime < 0) endTime = Long.MAX_VALUE; cctx.time().addTimeoutObject(this); } keys = qry.query().enableDedup() ? new HashSet<K>() : null; }
/** * Completeness callback. * * @param success If {@code true}, then lock has been acquired. */ private void onComplete(boolean success) { if (!success) undoLocks(); if (tx != null && success) ((GridNearTxLocal)tx).clearLockFuture(this); if (onDone(success, err)) { if (log.isDebugEnabled()) log.debug("Completing future: " + this); cache.onFutureDone(this); if (timeoutObj != null) cctx.time().removeTimeoutObject(timeoutObj); } }
cctx.time().addTimeoutObject(timeoutObj);
/** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { // Append cache name to the topic. topicPrefix = "CONTINUOUS_QUERY" + (cctx.name() == null ? "" : "_" + cctx.name()); if (cctx.affinityNode()) { cctx.io().addCacheHandler(cctx.cacheId(), CacheContinuousQueryBatchAck.class, new CI2<UUID, CacheContinuousQueryBatchAck>() { @Override public void apply(UUID uuid, CacheContinuousQueryBatchAck msg) { CacheContinuousQueryListener lsnr = lsnrs.get(msg.routineId()); if (lsnr != null) lsnr.cleanupBackupQueue(msg.updateCntrs()); } }); cancelableTask = cctx.time().schedule(new BackupCleaner(lsnrs, cctx.kernalContext()), BACKUP_ACK_FREQ, BACKUP_ACK_FREQ); } }
cctx.time().removeTimeoutObject(timeoutObj);
cctx.time().removeTimeoutObject(timeoutObj);
timeoutObj = new LockTimeoutObject(); cctx.time().addTimeoutObject(timeoutObj);
/** * @param primaryId Primary ID. * @param msg Message. */ private void sendDeferredUpdateResponse(UUID primaryId, GridDhtAtomicDeferredUpdateResponse msg) { try { GridTimeoutObject timeoutSnd = msg.timeoutSender(); if (timeoutSnd != null) ctx.time().removeTimeoutObject(timeoutSnd); ctx.io().send(primaryId, msg, ctx.ioPolicy()); if (msgLog.isDebugEnabled()) { msgLog.debug("Sent deferred DHT update response [futIds=" + msg.futureIds() + ", node=" + primaryId + ']'); } } catch (ClusterTopologyCheckedException ignored) { if (msgLog.isDebugEnabled()) { msgLog.debug("Failed to send deferred DHT update response, node left [" + "futIds=" + msg.futureIds() + ", node=" + primaryId + ']'); } } catch (IgniteCheckedException e) { U.error(log, "Failed to send deferredDHT update response to remote node [" + "futIds=" + msg.futureIds() + ", node=" + primaryId + ']', e); } }
timeoutObj = new LockTimeoutObject(); cctx.time().addTimeoutObject(timeoutObj);
timeoutObj = new LockTimeoutObject(); cctx.time().addTimeoutObject(timeoutObj);
cctx.time().waitAsync(fut, tx == null ? 0 : tx.remainingTime(), (e, timedOut) -> { if (errorOrTimeoutOnTopologyVersion(e, timedOut)) return;
cctx.time().removeTimeoutObject(timeoutObj);
cctx.time().addTimeoutObject(timeoutObj);
cctx.time().waitAsync(fut, tx.remainingTime(), (e, timedOut) -> { try { if (e != null || timedOut)