https://issues.apache.org/jira/browse/AMQ-4643 - update to jdbc checkpoint to validate connection before declaring success, is more bullit proof in preventing an early restart even if start is now deferred till after stop completes

This commit is contained in:
gtully 2013-09-03 16:34:25 +01:00
parent 29453d6793
commit b588d6cb9b
2 changed files with 6 additions and 1 deletions

View File

@ -665,6 +665,9 @@ public class JDBCPersistenceAdapter extends DataSourceServiceSupport implements
Connection connection = null;
try {
connection = getDataSource().getConnection();
if (!connection.isValid(10)) {
throw new IOException("isValid(10) failed for: " + connection);
}
} catch (SQLException e) {
LOG.debug("Could not get JDBC connection for checkpoint: " + e);
throw IOExceptionSupport.create(e);

View File

@ -27,6 +27,7 @@ import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.derby.jdbc.EmbeddedDataSource;
import org.junit.Ignore;
public class JDBCTestMemory extends TestCase {
@ -83,6 +84,7 @@ public class JDBCTestMemory extends TestCase {
dest = sess.createQueue("test");
}
@Ignore("requires human input to terminate!")
public void testRecovery() throws Exception {
init();
MessageProducer producer = sess.createProducer(dest);