Source:
private RemoteTransaction getOrCreateRemoteTransaction(GlobalTransaction globalTx, WriteCommand[] modifications, int topologyId) { RemoteTransaction existingTransaction = remoteTransactions.get(globalTx); if (existingTransaction != null) return existingTransaction; if (!running) { throw log.cacheIsStopping(cacheName); } int viewId = rpcManager.getTransport().getViewId(); if (!rpcManager.getTransport().getMembers().contains(globalTx.getAddress())) { throw new CacheException( "Cannot create remote transaction " + globalTx + ", the originator is not in the cluster view"); } RemoteTransaction newTransaction = modifications == null ? txFactory.newRemoteTransaction(globalTx, topologyId) : txFactory.newRemoteTransaction(modifications, globalTx, topologyId); RemoteTransaction remoteTransaction = remoteTransactions.compute(globalTx, (gtx, existing) -> { if (existing != null) { if (trace) log.tracef("Remote transaction already registered: %s", existing); return existing; } else { if (isTransactionCompleted(gtx)) { throw new CacheException("Cannot create remote transaction " + gtx + ", already completed"); } if (trace) log.tracef("Created and registered remote transaction %s", newTransaction); if (topologyId < minTxTopologyId) { if (trace) log.tracef("Changing minimum topology ID from %d to %d", minTxTopologyId, topologyId); minTxTopologyId = topologyId; } return newTransaction; } }); if (rpcManager.getTransport().getViewId() != viewId && !rpcManager.getTransport().getMembers().contains(globalTx.getAddress())) { if (partitionHandlingManager.canRollbackTransactionAfterOriginatorLeave(globalTx)) { log.debugf("Rolling back transaction %s because originator %s left the cluster", globalTx, globalTx.getAddress()); killTransaction(globalTx); } return remoteTransaction; } return remoteTransaction; }

Target:
private RemoteTransaction getOrCreateRemoteTransaction(GlobalTransaction globalTx, WriteCommand[] modifications, int topologyId) { RemoteTransaction existingTransaction = remoteTransactions.get(globalTx); if (existingTransaction != null) return existingTransaction; if (!running) { throw log.cacheIsStopping(cacheName); } int viewId = rpcManager.getTransport().getViewId(); if (!rpcManager.getTransport().getMembers().contains(globalTx.getAddress())) { throw log.remoteTransactionOriginatorNotInView(globalTx); } RemoteTransaction newTransaction = modifications == null ? txFactory.newRemoteTransaction(globalTx, topologyId) : txFactory.newRemoteTransaction(modifications, globalTx, topologyId); RemoteTransaction remoteTransaction = remoteTransactions.compute(globalTx, (gtx, existing) -> { if (existing != null) { if (trace) log.tracef("Remote transaction already registered: %s", existing); return existing; } else { if (isTransactionCompleted(gtx)) { throw log.remoteTransactionAlreadyCompleted(gtx); } if (trace) log.tracef("Created and registered remote transaction %s", newTransaction); if (topologyId < minTxTopologyId) { if (trace) log.tracef("Changing minimum topology ID from %d to %d", minTxTopologyId, topologyId); minTxTopologyId = topologyId; } return newTransaction; } }); if (rpcManager.getTransport().getViewId() != viewId && !rpcManager.getTransport().getMembers().contains(globalTx.getAddress())) { if (partitionHandlingManager.canRollbackTransactionAfterOriginatorLeave(globalTx)) { log.debugf("Rolling back transaction %s because originator %s left the cluster", globalTx, globalTx.getAddress()); killTransaction(globalTx); } return remoteTransaction; } return remoteTransaction; }