activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1407621 - in /activemq/trunk: activemq-core/src/test/java/org/apache/activemq/broker/ft/ activemq-core/src/test/java/org/apache/activemq/store/jdbc/ activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/
Date Fri, 09 Nov 2012 20:36:28 GMT
Author: gtully
Date: Fri Nov  9 20:36:27 2012
New Revision: 1407621

URL: http://svn.apache.org/viewvc?rev=1407621&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-4103 - fix default jdbc locker impl - same problem
as lease after refactor from https://issues.apache.org/jira/browse/AMQ-4005

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/DatabaseLockerConfigTest.java
  (contents, props changed)
      - copied, changed from r1407614, activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java
Removed:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java
Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveLeaseTest.java
    activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveLeaseTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveLeaseTest.java?rev=1407621&r1=1407620&r2=1407621&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveLeaseTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/DbRestartJDBCQueueMasterSlaveLeaseTest.java
Fri Nov  9 20:36:27 2012
@@ -31,9 +31,9 @@ public class DbRestartJDBCQueueMasterSla
     @Override
     protected void configureJdbcPersistenceAdapter(JDBCPersistenceAdapter persistenceAdapter)
throws IOException {
         super.configureJdbcPersistenceAdapter(persistenceAdapter);
+        persistenceAdapter.setLocker(new LeaseDatabaseLocker());
         persistenceAdapter.getLocker().setLockAcquireSleepInterval(getLockAcquireSleepInterval());
         persistenceAdapter.setLockKeepAlivePeriod(getLockKeepAlivePeriod());
-        persistenceAdapter.setLocker(new LeaseDatabaseLocker());
     }
 
     private long getLockKeepAlivePeriod() {

Copied: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/DatabaseLockerConfigTest.java
(from r1407614, 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/DatabaseLockerConfigTest.java?p2=activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/DatabaseLockerConfigTest.java&p1=activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java&r1=1407614&r2=1407621&rev=1407621&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerConfigTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/jdbc/DatabaseLockerConfigTest.java
Fri Nov  9 20:36:27 2012
@@ -17,22 +17,15 @@
 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();
-    }
+public class DatabaseLockerConfigTest {
 
     @Test
     public void testSleepConfig() throws Exception {
+        LeaseDatabaseLocker underTest = new LeaseDatabaseLocker();
         underTest.setLockAcquireSleepInterval(50);
         underTest.configure(null);
         assertEquals("configured sleep value retained", 50, underTest.getLockAcquireSleepInterval());
@@ -40,6 +33,22 @@ public class LeaseDatabaseLockerConfigTe
 
     @Test
     public void testDefaultSleepConfig() throws Exception {
+        LeaseDatabaseLocker underTest = new LeaseDatabaseLocker();
+        underTest.configure(null);
+        assertEquals("configured sleep value retained", AbstractLocker.DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL,
underTest.getLockAcquireSleepInterval());
+    }
+
+        @Test
+    public void testSleepConfigOrig() throws Exception {
+        DefaultDatabaseLocker underTest = new DefaultDatabaseLocker();
+        underTest.setLockAcquireSleepInterval(50);
+        underTest.configure(null);
+        assertEquals("configured sleep value retained", 50, underTest.getLockAcquireSleepInterval());
+    }
+
+    @Test
+    public void testDefaultSleepConfigOrig() throws Exception {
+        DefaultDatabaseLocker underTest = new DefaultDatabaseLocker();
         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/DatabaseLockerConfigTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java?rev=1407621&r1=1407620&r2=1407621&view=diff
==============================================================================
--- activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
(original)
+++ activemq/trunk/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
Fri Nov  9 20:36:27 2012
@@ -39,7 +39,6 @@ import org.slf4j.LoggerFactory;
  * 
  */
 public class DefaultDatabaseLocker extends AbstractLocker {
-    public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL = 1000;
     private static final Logger LOG = LoggerFactory.getLogger(DefaultDatabaseLocker.class);
     protected DataSource dataSource;
     protected Statements statements;
@@ -56,7 +55,6 @@ public class DefaultDatabaseLocker exten
             this.dataSource = ((JDBCPersistenceAdapter) adapter).getLockDataSource();
             this.statements = ((JDBCPersistenceAdapter) adapter).getStatements();
         }
-        lockAcquireSleepInterval = DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL;
     }
     
     public void doStart() throws Exception {



Mime
View raw message