Source:
<code>private RemoteTransaction getOrCreateRemoteTransaction(GlobalTransaction globalTx, WriteCommand[] modifications, int topologyId) { RemoteTransaction remoteTransaction = remoteTransactions.get(globalTx); if (remoteTransaction != null) return remoteTransaction; if (!running) { throw log.cacheIsStopping(cacheName); } return remoteTransactions.compute(globalTx, (gtx, existing) -> { if (existing != null) { if (trace) log.tracef("Remote transaction already registered: %s", existing); return existing; } else { if (isTransactionCompleted(globalTx)) { throw new IllegalStateException("Cannot create remote transaction " + globalTx + ", already completed"); } <START> if (!rpcManager.getTransport().getMembers().contains(gtx.getAddress())) { <END> throw new IllegalStateException( "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); 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; } }); }</code><technical_language>checking members compute block? I smell race conditions membership change lock this map</technical_language>

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 new IllegalStateException( "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 IllegalStateException("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; }