in geronimo-connector/src/main/java/org/apache/geronimo/connector/ConnectorTransactionContext.java [37:64]
public static ConnectorTransactionContext get(Transaction transaction) {
if (transaction == null) {
throw new NullPointerException("transaction is null");
}
ConnectorTransactionContext ctx = DATA_INDEX.get(transaction);
if (ctx == null) {
ctx = new ConnectorTransactionContext();
try {
int status = transaction.getStatus();
if (status != Status.STATUS_COMMITTED && status != Status.STATUS_ROLLEDBACK && status != Status.STATUS_UNKNOWN) {
((TransactionImpl)transaction).registerInterposedSynchronization(new ConnectorSynchronization(ctx, transaction));
// Note: no synchronization is necessary here. Since a transaction can only be associated with a single
// thread at a time, it should not be possible for someone else to have snuck in and created a
// ConnectorTransactionContext for this transaction. We still protect against that with the putIfAbsent
// call below, and we simply have an extra transaction synchronization registered that won't do anything
DATA_INDEX.putIfAbsent(transaction, ctx);
}
// } catch (RollbackException e) {
// throw (IllegalStateException) new IllegalStateException("Transaction is already rolled back").initCause(e);
} catch (SystemException e) {
throw new RuntimeException("Unable to register ejb transaction synchronization callback", e);
}
}
return ctx;
}