fix up test regression causing hang broker needs to be started and stopped for jdbc pa test

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1423828 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-12-19 11:25:04 +00:00
parent df2c7bdad4
commit 0f3ce45cff
2 changed files with 11 additions and 5 deletions

View File

@ -34,21 +34,22 @@ import org.apache.activemq.command.MessageId;
abstract public class PersistenceAdapterTestSupport extends TestCase { abstract public class PersistenceAdapterTestSupport extends TestCase {
protected PersistenceAdapter pa; protected PersistenceAdapter pa;
protected BrokerService brokerService = new BrokerService(); protected BrokerService brokerService;
abstract protected PersistenceAdapter createPersistenceAdapter(boolean delete) throws Exception; abstract protected PersistenceAdapter createPersistenceAdapter(boolean delete) throws Exception;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
brokerService = new BrokerService();
pa = createPersistenceAdapter(true); pa = createPersistenceAdapter(true);
pa.start(); brokerService.setPersistenceAdapter(pa);
brokerService.start();
} }
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
if( pa!=null ) { if (brokerService != null) {
pa.stop(); brokerService.stop();
pa=null;
} }
} }

View File

@ -99,6 +99,11 @@ public class DefaultDatabaseLocker extends AbstractLocker {
// closed when an error occurs so that we're not leaking // closed when an error occurs so that we're not leaking
// connections // connections
if (null != connection) { if (null != connection) {
try {
connection.rollback();
} catch (SQLException e1) {
LOG.error("Caught exception during rollback on connection: " + e1, e1);
}
try { try {
connection.close(); connection.close();
} catch (SQLException e1) { } catch (SQLException e1) {