[Mulgara-svn] r175 - trunk/src/jar/resolver/java/org/mulgara/resolver
pag at mulgara.org
pag at mulgara.org
Fri Feb 23 22:20:04 UTC 2007
Author: pag
Date: 2007-02-23 16:20:03 -0600 (Fri, 23 Feb 2007)
New Revision: 175
Modified:
trunk/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java
Log:
Fixed some cases where the current thread can be left in an invalid state after an exception occurs
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java 2007-02-23 22:19:04 UTC (rev 174)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/MulgaraTransaction.java 2007-02-23 22:20:03 UTC (rev 175)
@@ -110,9 +110,7 @@
throw new MulgaraTransactionException("Attempt to activate failed transaction");
}
- if (currentThread == null) {
- currentThread = Thread.currentThread();
- } else if (!currentThread.equals(Thread.currentThread())) {
+ if (currentThread != null && !currentThread.equals(Thread.currentThread())) {
throw new MulgaraTransactionException("Concurrent access attempted to transaction: Transaction has NOT been rolledback.");
}
@@ -129,6 +127,10 @@
}
}
+ if (currentThread == null) {
+ currentThread = Thread.currentThread();
+ }
+
inuse++;
checkActivated();
@@ -147,12 +149,15 @@
inuse--;
if (inuse == 0) {
- if (using == 0) {
- terminateTransaction();
- } else {
- suspendTransaction();
+ try {
+ if (using == 0) {
+ terminateTransaction();
+ } else {
+ suspendTransaction();
+ }
+ } finally {
+ currentThread = null;
}
- currentThread = null;
}
} finally {
report("Deactivated Transaction");
More information about the Mulgara-svn
mailing list