mirror of https://github.com/apache/activemq.git
extend the lease period in the test to make more deterministic wrt timing
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1511842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0ba311f14b
commit
c7aad77a16
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||||
public class DbRestartJDBCQueueMasterSlaveLeaseQuiesceTest extends DbRestartJDBCQueueMasterSlaveLeaseTest {
|
public class DbRestartJDBCQueueMasterSlaveLeaseQuiesceTest extends DbRestartJDBCQueueMasterSlaveLeaseTest {
|
||||||
private static final transient Logger LOG = LoggerFactory.getLogger(DbRestartJDBCQueueMasterSlaveLeaseQuiesceTest.class);
|
private static final transient Logger LOG = LoggerFactory.getLogger(DbRestartJDBCQueueMasterSlaveLeaseQuiesceTest.class);
|
||||||
|
|
||||||
private long restartDelay = 500;
|
private long restartDelay = 2000;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configureBroker(BrokerService brokerService) {
|
protected void configureBroker(BrokerService brokerService) {
|
||||||
|
@ -37,7 +37,7 @@ public class DbRestartJDBCQueueMasterSlaveLeaseQuiesceTest extends DbRestartJDBC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void delayTillRestartRequired() {
|
protected void delayTillRestartRequired() {
|
||||||
if (restartDelay > 500) {
|
if (restartDelay > 2000) {
|
||||||
LOG.info("delay for more than lease quantum. While Db is offline, master should stay alive but could loose lease");
|
LOG.info("delay for more than lease quantum. While Db is offline, master should stay alive but could loose lease");
|
||||||
} else {
|
} else {
|
||||||
LOG.info("delay for less than lease quantum. While Db is offline, master should stay alive");
|
LOG.info("delay for less than lease quantum. While Db is offline, master should stay alive");
|
||||||
|
@ -61,12 +61,12 @@ public class DbRestartJDBCQueueMasterSlaveLeaseQuiesceTest extends DbRestartJDBC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
restartDelay = 500;
|
restartDelay = 2000;
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSendReceiveWithLeaseExpiry() throws Exception {
|
public void testSendReceiveWithLeaseExpiry() throws Exception {
|
||||||
restartDelay = 3000;
|
restartDelay = 10000;
|
||||||
testSendReceive();
|
testSendReceive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,10 @@ public class DbRestartJDBCQueueMasterSlaveLeaseTest extends DbRestartJDBCQueueMa
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getLockKeepAlivePeriod() {
|
private long getLockKeepAlivePeriod() {
|
||||||
return 500;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getLockAcquireSleepInterval() {
|
private long getLockAcquireSleepInterval() {
|
||||||
return 2000;
|
return 8000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import javax.jms.TransactionRolledBackException;
|
||||||
import org.apache.activemq.ActiveMQConnection;
|
import org.apache.activemq.ActiveMQConnection;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.command.ActiveMQMessage;
|
import org.apache.activemq.command.ActiveMQMessage;
|
||||||
|
import org.apache.activemq.command.MessageId;
|
||||||
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
|
||||||
import org.apache.derby.jdbc.EmbeddedDataSource;
|
import org.apache.derby.jdbc.EmbeddedDataSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -114,10 +115,11 @@ public class DbRestartJDBCQueueMasterSlaveTest extends JDBCQueueMasterSlaveTest
|
||||||
java.sql.Connection dbConnection = null;
|
java.sql.Connection dbConnection = null;
|
||||||
try {
|
try {
|
||||||
ActiveMQMessage mqMessage = (ActiveMQMessage) message;
|
ActiveMQMessage mqMessage = (ActiveMQMessage) message;
|
||||||
|
MessageId id = mqMessage.getMessageId();
|
||||||
dbConnection = sharedDs.getConnection();
|
dbConnection = sharedDs.getConnection();
|
||||||
PreparedStatement s = dbConnection.prepareStatement(((JDBCPersistenceAdapter) connectedToBroker().getPersistenceAdapter()).getStatements().getFindMessageStatement());
|
PreparedStatement s = dbConnection.prepareStatement(((JDBCPersistenceAdapter) connectedToBroker().getPersistenceAdapter()).getStatements().getFindMessageStatement());
|
||||||
s.setString(1, mqMessage.getMessageId().getProducerId().toString());
|
s.setString(1, id.getProducerId().toString());
|
||||||
s.setLong(2, mqMessage.getMessageId().getProducerSequenceId());
|
s.setLong(2, id.getProducerSequenceId());
|
||||||
ResultSet rs = s.executeQuery();
|
ResultSet rs = s.executeQuery();
|
||||||
|
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
|
|
Loading…
Reference in New Issue