activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQ-1063 - revert delayed change to inTx flag, now cleared before exception is thrown by getConnection, this ensures jms transactions can use autocommit=false
Date Mon, 09 Dec 2013 17:03:01 GMT
Updated Branches:
  refs/heads/trunk 3797da64f -> b7c430d06


https://issues.apache.org/jira/browse/AMQ-1063 - revert delayed change to inTx flag, now cleared
before exception is thrown by getConnection, this ensures jms transactions can use autocommit=false


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/b7c430d0
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/b7c430d0
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/b7c430d0

Branch: refs/heads/trunk
Commit: b7c430d0683c8f682c5a88a063a8bbdda0ebdf07
Parents: 3797da6
Author: gtully <gary.tully@gmail.com>
Authored: Mon Dec 9 17:01:56 2013 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Mon Dec 9 17:02:32 2013 +0000

----------------------------------------------------------------------
 .../org/apache/activemq/store/jdbc/TransactionContext.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/b7c430d0/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java
----------------------------------------------------------------------
diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java
b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java
index 66163b6..6a933b0 100755
--- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java
+++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java
@@ -38,7 +38,7 @@ public class TransactionContext {
     private final DataSource dataSource;
     private final JDBCPersistenceAdapter persistenceAdapter;
     private Connection connection;
-    private volatile boolean inTx;
+    private boolean inTx;
     private PreparedStatement addMessageStatement;
     private PreparedStatement removedMessageStatement;
     private PreparedStatement updateLastAckStatement;
@@ -63,6 +63,8 @@ public class TransactionContext {
                 }
             } catch (SQLException e) {
                 JDBCPersistenceAdapter.log("Could not get JDBC connection: ", e);
+                inTx = false;
+                close();
                 IOException ioe = IOExceptionSupport.create(e);
                 persistenceAdapter.getBrokerService().handleIOException(ioe);
                 throw ioe;
@@ -160,9 +162,8 @@ public class TransactionContext {
         if (inTx) {
             throw new IOException("Already started.");
         }
-        connection = getConnection();
-        // only mark in tx if we could get a connection
         inTx = true;
+        connection = getConnection();
     }
 
     public void commit() throws IOException {


Mime
View raw message