mirror of https://github.com/apache/activemq.git
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:
parent
29453d6793
commit
b588d6cb9b
|
@ -665,6 +665,9 @@ public class JDBCPersistenceAdapter extends DataSourceServiceSupport implements
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
try {
|
try {
|
||||||
connection = getDataSource().getConnection();
|
connection = getDataSource().getConnection();
|
||||||
|
if (!connection.isValid(10)) {
|
||||||
|
throw new IOException("isValid(10) failed for: " + connection);
|
||||||
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOG.debug("Could not get JDBC connection for checkpoint: " + e);
|
LOG.debug("Could not get JDBC connection for checkpoint: " + e);
|
||||||
throw IOExceptionSupport.create(e);
|
throw IOExceptionSupport.create(e);
|
||||||
|
|
|
@ -27,6 +27,7 @@ import junit.framework.TestCase;
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
|
||||||
public class JDBCTestMemory extends TestCase {
|
public class JDBCTestMemory extends TestCase {
|
||||||
|
@ -82,7 +83,8 @@ public class JDBCTestMemory extends TestCase {
|
||||||
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
dest = sess.createQueue("test");
|
dest = sess.createQueue("test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore("requires human input to terminate!")
|
||||||
public void testRecovery() throws Exception {
|
public void testRecovery() throws Exception {
|
||||||
init();
|
init();
|
||||||
MessageProducer producer = sess.createProducer(dest);
|
MessageProducer producer = sess.createProducer(dest);
|
||||||
|
|
Loading…
Reference in New Issue