activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r955168 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
Date Wed, 16 Jun 2010 09:38:46 GMT
Author: rajdavies
Date: Wed Jun 16 09:38:46 2010
New Revision: 955168

URL: http://svn.apache.org/viewvc?rev=955168&view=rev
Log:
clear down async tasks on stop

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java?rev=955168&r1=955167&r2=955168&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
Wed Jun 16 09:38:46 2010
@@ -172,6 +172,9 @@ public class KahaDBStore extends Message
     public void setMaxAsyncJobs(int maxAsyncJobs) {
         this.maxAsyncJobs = maxAsyncJobs;
     }
+    
+    
+
 
     @Override
     public void doStart() throws Exception {
@@ -200,12 +203,17 @@ public class KahaDBStore extends Message
 
     @Override
     public void doStop(ServiceStopper stopper) throws Exception {
+        //drain down async jobs
+        LOG.info("Stopping async queue tasks");
+        this.globalQueueSemaphore.tryAcquire(this.maxAsyncJobs, 60, TimeUnit.SECONDS);
         synchronized (this.asyncQueueMap) {
             for (StoreQueueTask task : this.asyncQueueMap.values()) {
                 task.cancel();
             }
             this.asyncQueueMap.clear();
         }
+        LOG.info("Stopping async topic tasks");
+        this.globalTopicSemaphore.tryAcquire(this.maxAsyncJobs, 60, TimeUnit.SECONDS);
         synchronized (this.asyncTopicMap) {
             for (StoreTopicTask task : this.asyncTopicMap.values()) {
                 task.cancel();
@@ -224,6 +232,7 @@ public class KahaDBStore extends Message
         if (this.topicExecutor != null) {
             this.topicExecutor.shutdownNow();
         }
+        LOG.info("Stopped KahaDB");
         super.doStop(stopper);
     }
 



Mime
View raw message