activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r434007 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc: DefaultDatabaseLocker.java JDBCPersistenceAdapter.java
Date Wed, 23 Aug 2006 10:55:55 GMT
Author: jstrachan
Date: Wed Aug 23 03:55:55 2006
New Revision: 434007

URL: http://svn.apache.org/viewvc?rev=434007&view=rev
Log:
Have just added a short circuit for the loop trying to acquire the exclusive lock so that
we fail fast if we are stopping to fix AMQ-893

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java?rev=434007&r1=434006&r2=434007&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
Wed Aug 23 03:55:55 2006
@@ -40,6 +40,7 @@
     private final Statements statements;
     private long sleepTime = 1000;
     private Connection connection;
+    private boolean stopping;
 
     public DefaultDatabaseLocker(DataSource dataSource, Statements statements) {
         this.dataSource = dataSource;
@@ -47,6 +48,7 @@
     }
 
     public void start() throws Exception {
+        stopping = false;
         connection = dataSource.getConnection();
         connection.setAutoCommit(false);
         
@@ -60,6 +62,9 @@
                 }
             }
             catch (Exception e) {
+                if (stopping) { 
+                    throw new Exception("Cannot start broker as being asked to shut down.
Interupted attempt to acquire lock: " + e, e);
+                }
                 log.error("Failed to acquire lock: " + e, e);
             }
             log.debug("Sleeping for " + sleepTime + " milli(s) before trying again to get
the lock...");
@@ -70,6 +75,7 @@
     }
 
     public void stop() throws Exception {
+        stopping = true;
         if (connection != null) {
             connection.rollback();
             connection.close();

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java?rev=434007&r1=434006&r2=434007&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
Wed Aug 23 03:55:55 2006
@@ -148,7 +148,6 @@
     }
 
     public void start() throws Exception {
-        
         getAdapter().setUseExternalMessageReferences(isUseExternalMessageReferences());
 
         TransactionContext transactionContext = getTransactionContext();



Mime
View raw message