if (getCurrentTransaction() != null)
throw new IllegalStateException("a transaction is already running on this thread");
try {
XAResourceManager resourceManager = tx.getResourceManager();
resourceManager.resume();
ThreadContext threadContext = ThreadContext.getThreadContext();
threadContext.setTransaction(tx);
inFlightTransactions.get(tx).setThreadContext(threadContext);
MDC.put(MDC_GTRID_KEY, tx.getGtrid());
} catch (XAException ex) {