Author: gtully Date: Wed Jul 22 11:58:14 2009 New Revision: 796681 URL: http://svn.apache.org/viewvc?rev=796681&view=rev Log: resolve potential test hang if jdbc persistence adapter stop results in an exception, it should handle and log any exceptions
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveTest.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java?rev=796681&r1=796680&r2=796681&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java Wed Jul 22 11:58:14 2009 @@ -115,13 +115,22 @@ public void stop() throws Exception { stopping = true; - if (connection != null && !connection.isClosed()) { - try { - connection.rollback(); - } catch (SQLException sqle) { - LOG.warn("Exception while rollbacking the connection on shutdown", sqle); - } - connection.close(); + try { + if (connection != null && !connection.isClosed()) { + try { + connection.rollback(); + } catch (SQLException sqle) { + LOG.warn("Exception while rollbacking the connection on shutdown", sqle); + } finally { + try { + connection.close(); + } catch (SQLException ignored) { + LOG.debug("Exception while closing connection on shutdown", ignored); + } + } + } + } catch (SQLException sqle) { + LOG.warn("Exception while checking close status of connection on shutdown", sqle); } } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveTest.java?rev=796681&r1=796680&r2=796681&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveTest.java Wed Jul 22 11:58:14 2009 @@ -14,6 +14,7 @@ protected void messageSent() throws Exception { if (++inflightMessageCount == failureCount) { + LOG.info("STOPPING d...@!!!!"); final EmbeddedDataSource ds = getExistingDataSource(); ds.setShutdownDatabase("shutdown"); LOG.info("DB stopp...@!!!!");