From 0a5ae2b68eb1379bb9146afc22d0ff51f0dfc9f2 Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Tue, 24 Feb 2009 14:18:29 +0000 Subject: [PATCH] additional fix for https://issues.apache.org/activemq/browse/AMQ-2074 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@747391 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/store/jdbc/DefaultDatabaseLocker.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java index 90b06b80cd..dd6b359ea8 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java @@ -95,7 +95,11 @@ public class DefaultDatabaseLocker implements DatabaseLocker { } LOG.debug("Sleeping for " + lockAcquireSleepInterval + " milli(s) before trying again to get the lock..."); - Thread.sleep(lockAcquireSleepInterval); + try { + Thread.sleep(lockAcquireSleepInterval); + } catch (InterruptedException ie) { + LOG.warn("Master lock retry sleep interrupted", ie); + } } LOG.info("Becoming the master on dataSource: " + dataSource); @@ -103,8 +107,12 @@ public class DefaultDatabaseLocker implements DatabaseLocker { public void stop() throws Exception { stopping = true; - if (connection != null) { - connection.rollback(); + if (connection != null && !connection.isClosed()) { + try { + connection.rollback(); + } catch (SQLException sqle) { + LOG.warn("Exception while rollbacking the connection on shutdown", sqle); + } connection.close(); } }