Source:
<code>public long commit() { if (!isInMyTransaction()) { throw new IllegalStateException("commit() called without a transaction!"); } operations.forEach(Runnable::run); AbstractTransactionalContext rootContext = TransactionalContext.getRootContext(); <START> TransactionalContext.getRootContext().setTxnContext(null); <END> long commitAddress = Address.NON_ADDRESS; if (iDidNotStartCorfuTxn) { log.warn("commit() called on an inner transaction not started by CorfuStore"); } else { try { commitAddress = this.objectsView.TXEnd(); } catch (Exception ex) { tablesInTxn.values().forEach(t -> t.getMetrics().incNumTxnAborts()); tablesInTxn.clear(); throw ex; } } long timeElapsed = System.nanoTime() - txnStartTime; switch (txnType) { case READ_ONLY: tablesInTxn.values().forEach(t -> t.getMetrics().setReadOnlyTxnTimes(timeElapsed)); break; case WRITE_ONLY: tablesInTxn.values().forEach(t -> t.getMetrics().setWriteOnlyTxnTimes(timeElapsed)); break; case READ_WRITE: tablesInTxn.values().forEach(t -> t.getMetrics().setReadWriteTxnTimes(timeElapsed)); break; default: log.error("UNKNOWN TxnType!!"); break; } log.debug("Txn committed on namespace {}", namespace); MultiObjectSMREntry writeSet = rootContext.getWriteSetInfo().getWriteSet(); final Map<String, List<CorfuStreamEntry>> mutations = new HashMap<>(); tablesInTxn.forEach((uuid, table) -> { List<CorfuStreamEntry> writesInTable = writeSet.getSMRUpdates(uuid).stream().map(entry -> CorfuStreamEntry.fromSMREntry(entry, 0)).collect(Collectors.toList()); mutations.put(table.getFullyQualifiedTableName(), writesInTable); }); commitCallbacks.forEach(cb -> cb.onCommit(mutations)); operations.clear(); tablesInTxn.values().forEach(table -> { log.debug(table.getMetrics().toString()); }); return commitAddress; }</code><technical_language>rootContext.setTxnContext(null)</technical_language>

Target:
public long commit() { if (!isInMyTransaction()) { throw new IllegalStateException("commit() called without a transaction!"); } operations.forEach(Runnable::run); AbstractTransactionalContext rootContext = TransactionalContext.getRootContext(); rootContext.setTxnContext(null); long commitAddress = Address.NON_ADDRESS; if (iDidNotStartCorfuTxn) { log.warn("commit() called on an inner transaction not started by CorfuStore"); } else { try { commitAddress = this.objectsView.TXEnd(); } catch (Exception ex) { tablesInTxn.values().forEach(t -> t.getMetrics().incNumTxnAborts()); tablesInTxn.clear(); throw ex; } } long timeElapsed = System.nanoTime() - txnStartTime; switch (txnType) { case READ_ONLY: tablesInTxn.values().forEach(t -> t.getMetrics().setReadOnlyTxnTimes(timeElapsed)); break; case WRITE_ONLY: tablesInTxn.values().forEach(t -> t.getMetrics().setWriteOnlyTxnTimes(timeElapsed)); break; case READ_WRITE: tablesInTxn.values().forEach(t -> t.getMetrics().setReadWriteTxnTimes(timeElapsed)); break; default: log.error("UNKNOWN TxnType!!"); break; } log.debug("Txn committed on namespace {}", namespace); MultiObjectSMREntry writeSet = rootContext.getWriteSetInfo().getWriteSet(); final Map<String, List<CorfuStreamEntry>> mutations = new HashMap<>(); tablesInTxn.forEach((uuid, table) -> { List<CorfuStreamEntry> writesInTable = writeSet.getSMRUpdates(uuid).stream().map(entry -> CorfuStreamEntry.fromSMREntry(entry, 0)).collect(Collectors.toList()); mutations.put(table.getFullyQualifiedTableName(), writesInTable); }); commitCallbacks.forEach(cb -> cb.onCommit(mutations)); operations.clear(); tablesInTxn.values().forEach(table -> { log.debug(table.getMetrics().toString()); }); return commitAddress; }