TransactionID txId = currentTransactionIdThreadLocal.get();
if (txId != null) {
throw new TransactionException("transaction already started");
}
LocalTransactionContext newTx = new LocalTransactionContext(transactionTimeoutSeconds, transactionIDFactory.createTransactionID());
contextMap.put(newTx.getTransactionId(), newTx);
currentTransactionIdThreadLocal.set(newTx.getTransactionId());
MDC.put(MDC_KEY, newTx.getTransactionId().toString());
LOG.debug("begun transaction {}", newTx.getTransactionId());
}