Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8B6A510189 for ; Mon, 9 Dec 2013 17:03:01 +0000 (UTC) Received: (qmail 39522 invoked by uid 500); 9 Dec 2013 17:03:01 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 39442 invoked by uid 500); 9 Dec 2013 17:03:01 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 39435 invoked by uid 99); 9 Dec 2013 17:03:01 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Dec 2013 17:03:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 21B628B1785; Mon, 9 Dec 2013 17:03:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gtully@apache.org To: commits@activemq.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer 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, 9 Dec 2013 17:03:01 +0000 (UTC) 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 Authored: Mon Dec 9 17:01:56 2013 +0000 Committer: gtully 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 {