activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [3/3] activemq git commit: fix failing RecoverExpiredMessagesTest - remove duplicate ref to secedualler task in jdbc pa inheritance and fix persistence adapter ref in test
Date Mon, 08 Dec 2014 14:01:21 GMT
fix failing RecoverExpiredMessagesTest - remove duplicate ref to secedualler task in jdbc pa
inheritance and fix persistence adapter ref in test


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/bc3587cf
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/bc3587cf
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/bc3587cf

Branch: refs/heads/trunk
Commit: bc3587cfc9a3a6d5c4bc9f0afa35cbe8e4653fe3
Parents: 919099b
Author: gtully <gary.tully@gmail.com>
Authored: Mon Dec 8 13:59:38 2014 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Mon Dec 8 14:00:43 2014 +0000

----------------------------------------------------------------------
 .../org/apache/activemq/broker/LockableServiceSupport.java  | 9 +++++++--
 .../apache/activemq/store/jdbc/JDBCPersistenceAdapter.java  | 7 -------
 .../java/org/apache/activemq/broker/BrokerTestSupport.java  | 4 ++--
 .../activemq/broker/store/RecoverExpiredMessagesTest.java   | 8 ++++++--
 4 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/bc3587cf/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
index 4f83d30..18199ce 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
@@ -39,7 +39,7 @@ public abstract class LockableServiceSupport extends ServiceSupport implements
L
     Locker locker;
     long lockKeepAlivePeriod = 0;
     private ScheduledFuture<?> keepAliveTicket;
-    private ScheduledThreadPoolExecutor clockDaemon;
+    protected ScheduledThreadPoolExecutor clockDaemon;
     protected BrokerService brokerService;
 
     /**
@@ -113,8 +113,9 @@ public abstract class LockableServiceSupport extends ServiceSupport implements
L
             if (locker != null) {
                 getLocker().stop();
             }
-            ThreadPoolUtils.shutdown(clockDaemon);
         }
+        ThreadPoolUtils.shutdown(clockDaemon);
+        clockDaemon = null;
     }
 
     protected void keepLockAlive() {
@@ -162,6 +163,10 @@ public abstract class LockableServiceSupport extends ServiceSupport implements
L
         return clockDaemon;
     }
 
+    public void setScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor clockDaemon) {
+        this.clockDaemon = clockDaemon;
+    }
+
     @Override
     public void setBrokerService(BrokerService brokerService) {
         this.brokerService = brokerService;

http://git-wip-us.apache.org/repos/asf/activemq/blob/bc3587cf/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
----------------------------------------------------------------------
diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
index aea8fa0..e335926 100755
--- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
+++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
@@ -85,7 +85,6 @@ public class JDBCPersistenceAdapter extends DataSourceServiceSupport implements
     private Statements statements;
     private JDBCAdapter adapter;
     private MemoryTransactionStore transactionStore;
-    private ScheduledThreadPoolExecutor clockDaemon;
     private ScheduledFuture<?> cleanupTicket;
     private int cleanupPeriod = 1000 * 60 * 5;
     private boolean useExternalMessageReferences;
@@ -337,8 +336,6 @@ public class JDBCPersistenceAdapter extends DataSourceServiceSupport implements
             cleanupTicket.cancel(true);
             cleanupTicket = null;
         }
-        
-        ThreadPoolUtils.shutdown(clockDaemon);        
     }
 
     public void cleanup() {
@@ -363,10 +360,6 @@ public class JDBCPersistenceAdapter extends DataSourceServiceSupport
implements
         }
     }
 
-    public void setScheduledThreadPoolExecutor(ScheduledThreadPoolExecutor clockDaemon) {
-        this.clockDaemon = clockDaemon;
-    }
-
     @Override
     public ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor() {
         if (clockDaemon == null) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/bc3587cf/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
index 147bf23..5fa0620 100755
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
@@ -63,12 +63,12 @@ public class BrokerTestSupport extends CombinationTestSupport {
     public static final boolean FAST_NO_MESSAGE_LEFT_ASSERT = System.getProperty("FAST_NO_MESSAGE_LEFT_ASSERT",
"true").equals("true");
 
     protected RegionBroker regionBroker;
-    protected BrokerService broker;
+    public BrokerService broker;
     protected long idGenerator;
     protected int msgIdGenerator;
     protected int txGenerator;
     protected int tempDestGenerator;
-    protected PersistenceAdapter persistenceAdapter;
+    public PersistenceAdapter persistenceAdapter;
 
     protected String queueName = "TEST";
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/bc3587cf/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
index 4d9718b..38e8ee7 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
@@ -34,15 +34,16 @@ import org.apache.activemq.command.Message;
 import org.apache.activemq.command.MessageAck;
 import org.apache.activemq.command.ProducerInfo;
 import org.apache.activemq.command.SessionInfo;
+import org.apache.activemq.openwire.OpenWireFormat;
 import org.apache.activemq.store.PersistenceAdapter;
 import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
 import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
+import org.apache.activemq.util.IOHelper;
 
 public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport {
     final ArrayList<String> expected = new ArrayList<String>();
     final ActiveMQDestination destination = new ActiveMQQueue("TEST");
     public PendingQueueMessageStoragePolicy queuePendingPolicy;
-    public PersistenceAdapter persistenceAdapter;
 
     @Override
     protected void setUp() throws Exception {
@@ -52,13 +53,16 @@ public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport
{
 
     public void initCombosForTestRecovery() throws Exception {
         addCombinationValues("queuePendingPolicy", new PendingQueueMessageStoragePolicy[]
{new FilePendingQueueMessageStoragePolicy(), new VMPendingQueueMessageStoragePolicy()});
-        addCombinationValues("persistenceAdapter", new PersistenceAdapter[] {new KahaDBPersistenceAdapter(),
new JDBCPersistenceAdapter()});
+        addCombinationValues("persistenceAdapter", new PersistenceAdapter[] {new KahaDBPersistenceAdapter(),
+                // need to supply the dataSource as it is used in parameter matching via
the toString
+                new JDBCPersistenceAdapter(JDBCPersistenceAdapter.createDataSource(IOHelper.getDefaultDataDirectory()),
new OpenWireFormat())});
     }
 
     public void testRecovery() throws Exception {
         sendSomeMessagesThatWillExpireIn5AndThenOne();
 
         broker.stop();
+        broker.waitUntilStopped();
         TimeUnit.SECONDS.sleep(6);
         broker = createRestartedBroker();
         broker.start();


Mime
View raw message