You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by li...@apache.org on 2008/12/03 03:50:41 UTC
svn commit: r722724 - in
/geronimo/components/txmanager/trunk/geronimo-transaction/src:
main/java/org/apache/geronimo/transaction/manager/
test/java/org/apache/geronimo/transaction/manager/
Author: linsun
Date: Tue Dec 2 18:50:40 2008
New Revision: 722724
URL: http://svn.apache.org/viewvc?rev=722724&view=rev
Log:
GERONIMO-4438 - TransactionSynchronizationRegistry.getTransactionKey should return null when transaction is not associated with the current thread
Modified:
geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java
Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java?rev=722724&r1=722723&r2=722724&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java (original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionManagerImpl.java Tue Dec 2 18:50:40 2008
@@ -205,8 +205,8 @@
}
public Object getTransactionKey() {
- TransactionImpl tx = getActiveTransactionImpl();
- return tx.getTransactionKey();
+ TransactionImpl tx = (TransactionImpl) getTransaction();
+ return tx == null ? null: tx.getTransactionKey();
}
public int getTransactionStatus() {
Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java?rev=722724&r1=722723&r2=722724&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java (original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java Tue Dec 2 18:50:40 2008
@@ -57,6 +57,15 @@
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();