Skip to content
Permalink
Browse files
GERONIMO-4438 - TransactionSynchronizationRegistry.getTransactionKey …
…should return null when transaction is not associated with the current thread

git-svn-id: https://svn.apache.org/repos/asf/geronimo/components/txmanager/trunk@722724 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Lin Sun committed Dec 3, 2008
1 parent 1571a01 commit 8dbd0d6f57d3d79a1888c2c640a953343adee9b6
Showing 2 changed files with 11 additions and 2 deletions.
@@ -205,8 +205,8 @@ public boolean getRollbackOnly() {
}

public Object getTransactionKey() {
TransactionImpl tx = getActiveTransactionImpl();
return tx.getTransactionKey();
TransactionImpl tx = (TransactionImpl) getTransaction();
return tx == null ? null: tx.getTransactionKey();
}

public int getTransactionStatus() {
@@ -57,6 +57,15 @@ private void setUpSyncs() throws Exception {
tm.getTransaction().registerSynchronization(normalSync);
}

public void testTransactionKey() throws Exception {
normalSync = new CountingSync();
assertNull(tm.getTransactionKey());
setUpInterposedSync();
tm.getTransaction().registerSynchronization(normalSync);
assertNotNull(tm.getTransactionKey());
tm.commit();
assertNull(tm.getTransactionKey());
}

public void testInterposedSynchIsCalledOnCommit() throws Exception {
setUpInterposedSync();

0 comments on commit 8dbd0d6

Please sign in to comment.