/** * Finish transaction. * * @param fast {@code True} in case of fast finish. * @param commit {@code True} if commit. * @return Transaction commit future. */ private NearTxFinishFuture finishFuture(boolean fast, boolean commit) { NearTxFinishFuture fut = fast ? new GridNearTxFastFinishFuture(this, commit) : new GridNearTxFinishFuture<>(cctx, this, commit); return mvccSnapshot != null ? new GridNearTxFinishAndAckFuture(fut) : fut; }
/** * @param nodeId Sender node id. * @param res Response. */ public void onResult(UUID nodeId, GridNearTxQueryEnlistResponse res) { MiniFuture mini = miniFuture(res.miniId()); if (mini != null) mini.onResult(res, null); }
/** {@inheritDoc} */ @Override public void onResult(UUID nodeId, GridNearTxPrepareResponse res) { if (!isDone()) { MiniFuture mini = miniFuture(res.miniId()); if (mini != null) mini.onResult(res, true); } }
/** * @param res Response. * @param updateMapping Update mapping flag. */ void onResult(GridNearTxPrepareResponse res, boolean updateMapping) { if (res.error() != null) onError(res.error()); else { onPrepareResponse(m, res, updateMapping); onDone(res); } }
/** * Cancellation has special meaning for lock futures. It's called then lock must be released on rollback. */ @Override public boolean cancel() { if (inTx()) onError(tx.rollbackException()); return onComplete(false, true); }
/** {@inheritDoc} */ @Override public Xid[] recover(int i) { if (cacheTx.state() == PREPARED) return new Xid[] { xid }; return NO_XID; }
/** * Checks if mapped transaction can be committed on one phase. * One-phase commit can be done if transaction maps to one primary node and not more than one backup. * * @param txMapping Transaction mapping. */ final void checkOnePhase(GridDhtTxMapping txMapping) { checkOnePhase(tx.transactionNodes()); }
/** * */ private void remap() { undoLocks(false, false); mapOnTopology(true); onDone(true); }
/** * @return Recovery flag. */ public final boolean recovery() { return isFlag(RECOVERY_FLAG_MASK); }
/** * @param fut Local enlist future. * @throws IgniteCheckedException if future is already completed. */ protected synchronized void clearLocalFuture(GridDhtTxAbstractEnlistFuture fut) throws IgniteCheckedException { checkCompleted(); if (localEnlistFuture == fut) localEnlistFuture = null; }
/** * @return Rollback future. */ public IgniteInternalFuture<IgniteInternalTx> rollbackNearTxLocalAsync() { return rollbackNearTxLocalAsync(true, false); }
/** * @param tx Transaction. * @param cctx Target cache context. */ public TxTopologyVersionFuture(GridNearTxLocal tx, GridCacheContext cctx) { this.tx = tx; this.cctx = cctx; init(); }
/** * @return {@code True} if implicit-single-tx flag is set. */ private boolean implicitSingleTx() { return tx != null && tx.implicitSingle(); }
/** * @return {@code True} if transaction is not {@code null} and has invalidate flag set. */ private boolean isInvalidate() { return tx != null && tx.isInvalidate(); }
/** {@inheritDoc} */ @Override protected boolean evictionDisabled() { assert lockedByCurrentThread(); return evictReservations > 0; }
/** {@inheritDoc} */ @Override protected void map(boolean topLocked) { this.topLocked = topLocked; sendNextBatches(null); }
/** * @return Need return value flag. */ public boolean needReturnValue() { return isFlag(NEED_RETURN_VALUE_FLAG_MASK); }
/** * @return Explicit lock flag. */ public final boolean explicitLock() { return isFlag(EXPLICIT_LOCK_FLAG_MASK); }