mirror of
https://github.com/apache/activemq.git
synced 2025-02-26 03:54:57 +00:00
resolve potential test hang if jdbc persistence adapter stop results in an exception, it should handle and log any exceptions
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@796681 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7f8eb612cd
commit
fb42a11835
@ -115,13 +115,22 @@ public class DefaultDatabaseLocker implements DatabaseLocker {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ public class DbRestartJDBCQueueMasterSlaveTest extends JDBCQueueMasterSlaveTest
|
||||
|
||||
protected void messageSent() throws Exception {
|
||||
if (++inflightMessageCount == failureCount) {
|
||||
LOG.info("STOPPING DB!@!!!!");
|
||||
final EmbeddedDataSource ds = getExistingDataSource();
|
||||
ds.setShutdownDatabase("shutdown");
|
||||
LOG.info("DB STOPPED!@!!!!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user