activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQ-5162 - introduce handleStartException configuration parameter, to make stopping of the slave broker optional
Date Tue, 27 May 2014 13:20:37 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk 9d656731a -> b5c6c1eae


https://issues.apache.org/jira/browse/AMQ-5162 - introduce handleStartException configuration
parameter, to make stopping of the slave broker optional


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

Branch: refs/heads/trunk
Commit: b5c6c1eaeb6eddafd5e0ee7020b4d152eb8c4979
Parents: 9d65673
Author: Dejan Bosanac <dejan@nighttale.net>
Authored: Tue May 27 15:20:27 2014 +0200
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Tue May 27 15:20:27 2014 +0200

----------------------------------------------------------------------
 .../activemq/store/jdbc/LeaseDatabaseLocker.java       | 13 ++++++++++++-
 .../store/jdbc/JDBCIOExceptionHandlerTest.java         |  2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/b5c6c1ea/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
----------------------------------------------------------------------
diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
index 3e35ee8..502c25c 100644
--- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
+++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
@@ -42,6 +42,7 @@ public class LeaseDatabaseLocker extends AbstractJDBCLocker {
     protected int maxAllowableDiffFromDBTime = 0;
     protected long diffFromCurrentTime = Long.MAX_VALUE;
     protected String leaseHolderId;
+    protected boolean handleStartException;
 
     public void doStart() throws Exception {
 
@@ -89,7 +90,9 @@ public class LeaseDatabaseLocker extends AbstractJDBCLocker {
                                     + "Interrupted attempt to acquire lock: "
                                     + e, e);
                 }
-                lockable.getBrokerService().handleIOException(IOExceptionSupport.create(e));
+                if (handleStartException) {
+                    lockable.getBrokerService().handleIOException(IOExceptionSupport.create(e));
+                }
             } finally {
                 close(statement);
                 close(connection);
@@ -231,6 +234,14 @@ public class LeaseDatabaseLocker extends AbstractJDBCLocker {
         this.maxAllowableDiffFromDBTime = maxAllowableDiffFromDBTime;
     }
 
+    public boolean isHandleStartException() {
+        return handleStartException;
+    }
+
+    public void setHandleStartException(boolean handleStartException) {
+        this.handleStartException = handleStartException;
+    }
+
     @Override
     public String toString() {
         return "LeaseDatabaseLocker owner:" + leaseHolderId + ",duration:" + lockAcquireSleepInterval
+ ",renew:" + lockAcquireSleepInterval;

http://git-wip-us.apache.org/repos/asf/activemq/blob/b5c6c1ea/activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java
index 50d1904..c56bc7f 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java
@@ -72,6 +72,7 @@ public class JDBCIOExceptionHandlerTest extends TestCase {
         jdbc.setLockKeepAlivePeriod(1000l);
         if (leaseLocker) {
             LeaseDatabaseLocker leaseDatabaseLocker = new LeaseDatabaseLocker();
+            leaseDatabaseLocker.setHandleStartException(true);
             leaseDatabaseLocker.setLockAcquireSleepInterval(2000l);
             jdbc.setLocker(leaseDatabaseLocker);
         }
@@ -130,6 +131,7 @@ public class JDBCIOExceptionHandlerTest extends TestCase {
 
                     if (lease) {
                         LeaseDatabaseLocker leaseDatabaseLocker = new LeaseDatabaseLocker();
+                        leaseDatabaseLocker.setHandleStartException(true);
                         leaseDatabaseLocker.setLockAcquireSleepInterval(2000l);
                         jdbc.setLocker(leaseDatabaseLocker);
                     }


Mime
View raw message