You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2012/10/15 12:38:59 UTC

svn commit: r1398238 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/store/jdbc/ test/java/org/apache/activemq/broker/ft/ test/java/org/apache/activemq/store/jdbc/

Author: gtully
Date: Mon Oct 15 10:38:59 2012
New Revision: 1398238

URL: http://svn.apache.org/viewvc?rev=1398238&view=rev
Log:
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

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java   (with props)
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java?rev=1398238&r1=1398237&r2=1398238&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java Mon Oct 15 10:38:59 2012
@@ -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
             this.dataSource = ((JDBCPersistenceAdapter) adapter).getLockDataSource();
             this.statements = ((JDBCPersistenceAdapter) adapter).getStatements();
         }
-        lockAcquireSleepInterval = DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL;
     }
     
     public void doStart() throws Exception {

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTest.java?rev=1398238&r1=1398237&r2=1398238&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTest.java Mon Oct 15 10:38:59 2012
@@ -122,7 +122,7 @@ public class QueueMasterSlaveTest extend
         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));

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java?rev=1398238&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java (added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java Mon Oct 15 10:38:59 2012
@@ -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());
+    }
+}

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date