/** * @param tx Tx. * @param txKeys Tx keys. * @return {@code True} if key is involved into tx. */ private boolean hasKeys(IgniteInternalTx tx, Collection<IgniteTxKey> txKeys) { for (IgniteTxKey key : txKeys) { if (tx.txState().entry(key) != null) return true; } return false; }
/** * @param tx Transaction to clear. */ public void clearThreadMap(IgniteInternalTx tx) { if (tx.local() && !tx.dht()) { assert tx instanceof GridNearTxLocal : tx; if (!tx.system()) threadMap.remove(tx.threadId(), tx); else { Integer cacheId = tx.txState().firstCacheId(); if (cacheId != null) sysThreadMap.remove(new TxThreadKey(tx.threadId(), cacheId), tx); else { for (Iterator<IgniteInternalTx> it = sysThreadMap.values().iterator(); it.hasNext(); ) { IgniteInternalTx txx = it.next(); if (tx == txx) { it.remove(); break; } } } } } }
append(", other=["); final IgniteTxState st = tx.txState();
/** * @param nodeId Node ID. * @param res Response. */ private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) { if (txPrepareMsgLog.isDebugEnabled()) txPrepareMsgLog.debug("Received near prepare response [txId=" + res.version() + ", node=" + nodeId + ']'); GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter)ctx.mvcc() .<IgniteInternalTx>versionedFuture(res.version(), res.futureId()); if (fut == null) { U.warn(log, "Failed to find future for near prepare response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); return; } IgniteInternalTx tx = fut.tx(); assert tx != null; res.txState(tx.txState()); fut.onResult(nodeId, res); }
/** * @param nodeId Node ID. * @param res Response. */ protected void processCheckPreparedTxResponse(UUID nodeId, GridCacheTxRecoveryResponse res) { if (txRecoveryMsgLog.isInfoEnabled()) { txRecoveryMsgLog.info("Received tx recovery response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); } GridCacheTxRecoveryFuture fut = (GridCacheTxRecoveryFuture)ctx.mvcc().future(res.futureId()); if (fut == null) { if (txRecoveryMsgLog.isInfoEnabled()) { txRecoveryMsgLog.info("Failed to find future for tx recovery response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); } return; } else res.txState(fut.tx().txState()); fut.onResult(nodeId, res); }
cctx.txMetrics().onTxRollback(); tx.txState().onTxEnd(cctx, tx, false);
/** * @param nodeId Node ID. * @param res Response. */ private void processDhtTxPrepareResponse(UUID nodeId, GridDhtTxPrepareResponse res) { GridDhtTxPrepareFuture fut = (GridDhtTxPrepareFuture)ctx.mvcc().versionedFuture(res.version(), res.futureId()); if (fut == null) { if (txPrepareMsgLog.isDebugEnabled()) { txPrepareMsgLog.debug("Failed to find future for dht prepare response [txId=null" + ", dhtTxId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); } return; } else if (txPrepareMsgLog.isDebugEnabled()) txPrepareMsgLog.debug("Received dht prepare response [txId=" + fut.tx().nearXidVersion() + ", node=" + nodeId + ']'); IgniteInternalTx tx = fut.tx(); assert tx != null; res.txState(tx.txState()); fut.onResult(nodeId, res); }
cctx.txMetrics().onTxCommit(); tx.txState().onTxEnd(cctx, tx, true);
continue; IgniteTxState state = tx.txState();
/** * @param tx Tx. * @param txKeys Tx keys. * @return {@code True} if key is involved into tx. */ private boolean hasKeys(IgniteInternalTx tx, Collection<IgniteTxKey> txKeys) { for (IgniteTxKey key : txKeys) { if (tx.txState().entry(key) != null) return true; } return false; }
/** * @param tx Transaction to clear. */ public void clearThreadMap(IgniteInternalTx tx) { if (tx.local() && !tx.dht()) { assert tx instanceof GridNearTxLocal : tx; if (!tx.system()) threadMap.remove(tx.threadId(), tx); else { Integer cacheId = tx.txState().firstCacheId(); if (cacheId != null) sysThreadMap.remove(new TxThreadKey(tx.threadId(), cacheId), tx); else { for (Iterator<IgniteInternalTx> it = sysThreadMap.values().iterator(); it.hasNext(); ) { IgniteInternalTx txx = it.next(); if (tx == txx) { it.remove(); break; } } } } } }
append(", other=["); final IgniteTxState st = tx.txState();
/** * @param nodeId Node ID. * @param res Response. */ private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) { if (txPrepareMsgLog.isDebugEnabled()) txPrepareMsgLog.debug("Received near prepare response [txId=" + res.version() + ", node=" + nodeId + ']'); GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter)ctx.mvcc() .<IgniteInternalTx>versionedFuture(res.version(), res.futureId()); if (fut == null) { U.warn(log, "Failed to find future for near prepare response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); return; } IgniteInternalTx tx = fut.tx(); assert tx != null; res.txState(tx.txState()); fut.onResult(nodeId, res); }
/** * @param nodeId Node ID. * @param res Response. */ protected void processCheckPreparedTxResponse(UUID nodeId, GridCacheTxRecoveryResponse res) { if (txRecoveryMsgLog.isInfoEnabled()) { txRecoveryMsgLog.info("Received tx recovery response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); } GridCacheTxRecoveryFuture fut = (GridCacheTxRecoveryFuture)ctx.mvcc().future(res.futureId()); if (fut == null) { if (txRecoveryMsgLog.isInfoEnabled()) { txRecoveryMsgLog.info("Failed to find future for tx recovery response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); } return; } else res.txState(fut.tx().txState()); fut.onResult(nodeId, res); }
cctx.txMetrics().onTxRollback(); tx.txState().onTxEnd(cctx, tx, false);
/** * @param nodeId Node ID. * @param res Response. */ private void processDhtTxPrepareResponse(UUID nodeId, GridDhtTxPrepareResponse res) { GridDhtTxPrepareFuture fut = (GridDhtTxPrepareFuture)ctx.mvcc().versionedFuture(res.version(), res.futureId()); if (fut == null) { if (txPrepareMsgLog.isDebugEnabled()) { txPrepareMsgLog.debug("Failed to find future for dht prepare response [txId=null" + ", dhtTxId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); } return; } else if (txPrepareMsgLog.isDebugEnabled()) txPrepareMsgLog.debug("Received dht prepare response [txId=" + fut.tx().nearXidVersion() + ", node=" + nodeId + ']'); IgniteInternalTx tx = fut.tx(); assert tx != null; res.txState(tx.txState()); fut.onResult(nodeId, res); }
cctx.txMetrics().onTxCommit(); tx.txState().onTxEnd(cctx, tx, true);
continue; IgniteTxState state = tx.txState();