https://issues.apache.org/jira/browse/AMQ-4103 - LeaseDatabaseLocker can not be changed from 5 sec poll - fix with test, default value now 10s to be consistent with other lockers and is also configurable. regression from https://issues.apache.org/jira/browse/AMQ-4005

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1398238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-10-15 10:38:59 +00:00
parent 8af1df7aea
commit 0a5ce71f6f
3 changed files with 47 additions and 3 deletions

View File

@ -42,7 +42,6 @@ import org.slf4j.LoggerFactory;
*/
public class LeaseDatabaseLocker extends AbstractLocker {
private static final Logger LOG = LoggerFactory.getLogger(LeaseDatabaseLocker.class);
public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL = 5000;
protected DataSource dataSource;
protected Statements statements;
@ -60,7 +59,6 @@ public class LeaseDatabaseLocker extends AbstractLocker {
this.dataSource = ((JDBCPersistenceAdapter) adapter).getLockDataSource();
this.statements = ((JDBCPersistenceAdapter) adapter).getStatements();
}
lockAcquireSleepInterval = DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL;
}
public void doStart() throws Exception {

View File

@ -122,7 +122,7 @@ public class QueueMasterSlaveTest extends JmsTopicSendReceiveWithTwoConnectionsT
assertNull("No message there yet", qConsumer.receive(1000));
qConsumer.close();
master.stop();
assertTrue("slave started", slaveStarted.await(10, TimeUnit.SECONDS));
assertTrue("slave started", slaveStarted.await(15, TimeUnit.SECONDS));
final String text = "ForUWhenSlaveKicksIn";
producer.send(new ActiveMQTopic("VirtualTopic.TA1"), session.createTextMessage(text));

View File

@ -0,0 +1,46 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.store.jdbc;
import org.apache.activemq.broker.AbstractLocker;
import org.junit.Before;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class LeaseDatabaseLockerConfigTest {
LeaseDatabaseLocker underTest;
@Before
public void setUpStore() throws Exception {
underTest = new LeaseDatabaseLocker();
}
@Test
public void testSleepConfig() throws Exception {
underTest.setLockAcquireSleepInterval(50);
underTest.configure(null);
assertEquals("configured sleep value retained", 50, underTest.getLockAcquireSleepInterval());
}
@Test
public void testDefaultSleepConfig() throws Exception {
underTest.configure(null);
assertEquals("configured sleep value retained", AbstractLocker.DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL, underTest.getLockAcquireSleepInterval());
}
}