@Override public ITransactionContext getTransactionContext(JobId jobId, boolean createIfNotExist) throws ACIDException { setMaxJobId(jobId.getId()); ITransactionContext txnCtx = transactionContextRepository.get(jobId); if (txnCtx == null) { if (createIfNotExist) { synchronized (this) { txnCtx = transactionContextRepository.get(jobId); if (txnCtx == null) { txnCtx = new TransactionContext(jobId, txnSubsystem); transactionContextRepository.put(jobId, txnCtx); } } } else { throw new ACIDException("TransactionContext of " + jobId + " doesn't exist."); } } return txnCtx; }