/** * Cleanup the remote txState after commit and rollback * @param txId * @return the TXStateProxy */ public final TXStateProxy removeHostedTXState(TXId txId, Boolean commit) { return removeHostedTXState(txId, this.txStateRemove, null, commit); }
protected final void removeSelfFromHosted(final Object callbackArg, final boolean doRemove) { if (doRemove) { TXStateProxy tx = this.txManager.removeHostedTXState(this.txId, checkEmpty, callbackArg, null); if (tx != null) { tx.cleanupEmpty(callbackArg); } } else { cleanupEmpty(callbackArg); } }
@Override protected boolean operateOnTX(TXStateProxy txProxy, DistributionManager dm) { // remove from hosted TXStates upfront so that there is no scope for a stray // message to create anything related to this TX final GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); final TXManagerImpl txMgr; if (cache != null && (txMgr = cache.getCacheTransactionManager()) != null) { txProxy = txMgr.removeHostedTXState(getTXId(), Boolean.FALSE); } if (txProxy != null) { txProxy.rollback(null, this.callbackArg); } return true; }
@Override protected boolean operateOnTx(TXId txId,DistributionManager dm) { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); if (cache == null) { throw new CacheClosedException(LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString()); } TXManagerImpl txMgr = cache.getTXMgr(); if (logger.isDebugEnabled()) { logger.debug("TX: Rolling back :{}", txId); } try { if (!txMgr.isHostedTxRecentlyCompleted(txId)) { txMgr.rollback(); } } finally { txMgr.removeHostedTXState(txId); } return true; }
logger.debug("TX: found a recently rolled back tx: {}", txId); sendRollbackReply(msg, servConn); txMgr.removeHostedTXState(txId); return; TXStateProxy proxy = txMgr.removeHostedTXState(txId); if (logger.isDebugEnabled()) { logger.debug("TX: removed tx state proxy {}", proxy);
@Override protected boolean operateOnTx(TXId txId,DistributionManager dm) throws RemoteOperationException { TXManagerImpl txMgr = GemFireCacheImpl.getInstance().getTXMgr(); if (logger.isDebugEnabled()) { logger.debug("JTA: Calling afterCompletion for :{}", txId); } TXStateProxy txState = txMgr.getTXState(); txState.setCommitOnBehalfOfRemoteStub(true); txState.afterCompletion(status); TXCommitMessage cmsg = txState.getCommitMessage(); TXRemoteCommitReplyMessage.send(getSender(), getProcessorId(), cmsg, getReplySender(dm)); txMgr.removeHostedTXState(txId); return false; }
try { CommitCommand.writeCommitResponse(cmsg, msg, servConn); txMgr.removeHostedTXState(txState.getTxId()); } catch (IOException e) {
@Override protected boolean operateOnTX(final TXStateProxy txProxy, DistributionManager dm) { if (txProxy != null) { txProxy.setCommitVersionSources(this.commitTime, this.regionDiskVersionSources); txProxy.addToBePublishedEvents(this.memberTailKeysMap); txProxy.commit(null /* indicates remote commit */, this.callbackArg); return true; } else { // if no TXState was created (e.g. due to only getEntry/size operations // that don't start remote TX) then ignore, but try to remove from hosted // txStates neverthless final GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); final TXManagerImpl txMgr; if (cache != null && (txMgr = cache.getCacheTransactionManager()) != null) { txMgr.removeHostedTXState(getTXId(), Boolean.TRUE); } return true; } }
@Override public void run() { final Collection<TXStateProxy> txs = getHostedTransactionsInProgress(); for (TXStateProxy tx : txs) { if (TXStateProxy.LOG_FINE || DistributionManager.VERBOSE) { getLogger().info(LocalizedStrings.DEBUG, "TX checking " + tx + " for departed: " + id); } if (tx.handleMemberDeparted(id, dm, crashed)) { // TODO: TX: currently always rolling back the transaction removeHostedTXState(tx.getTransactionId(), Boolean.FALSE); if (TXStateProxy.LOG_FINE || DistributionManager.VERBOSE) { getLogger().info(LocalizedStrings.DEBUG, "TX removed after member " + id + " departed: " + tx); } } } } });
txState = context != null ? context.getSnapshotTXState() : null; if (txState != null) { txManager.removeHostedTXState(txState.getTransactionId(), Boolean.TRUE);
sendException(msg, servConn, txMgr.getExceptionForToken(commitMsg, txId)); txMgr.removeHostedTXState(txId); return; } finally { if(txId!=null) { txMgr.removeHostedTXState(txId);
writeReply(msg, servConn); servConn.setAsTrue(RESPONDED); mgr.removeHostedTXState(txId); return; writeException(msg, new TransactionDataNodeHasDepartedException("Could not find transaction host for "+txId), false, servConn); servConn.setAsTrue(RESPONDED); mgr.removeHostedTXState(txId); return;
txMgr.removeHostedTXState(this.txId, Boolean.FALSE); signalLocalTXCommit();
} finally { if (commitSuccessful) { txMgr.removeHostedTXState(this.txId, Boolean.TRUE); signalLocalTXCommit();
imgState.unlockPendingTXRegionStates(true); if (removeTXState) { txMgr.removeHostedTXState(txId, Boolean.FALSE);
this.txManager.removeHostedTXState(this.txId, Boolean.TRUE); signalLocalTXCommit();