activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1234000 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-website/src/documentation/
Date Fri, 20 Jan 2012 16:53:51 GMT
Author: chirino
Date: Fri Jan 20 16:53:51 2012
New Revision: 1234000

URL: http://svn.apache.org/viewvc?rev=1234000&view=rev
Log:
Fixing auto delete logic for queues.  Bring down that default auto delete time to 30 seconds.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
    activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala?rev=1234000&r1=1233999&r2=1234000&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
Fri Jan 20 16:53:51 2012
@@ -157,40 +157,10 @@ class Queue(val router: LocalRouter, val
   var tune_catchup_enqueue_rate = 0
 
   /**
-   *  Tthe rate at which producers are throttled at.
+   *  The rate at which producers are throttled at.
    */
   var tune_max_enqueue_rate = 0
 
-  def configure(c:QueueDTO) = {
-    config = c
-    tune_persistent = virtual_host.store !=null && config.persistent.getOrElse(true)
-    tune_swap = tune_persistent && config.swap.getOrElse(true)
-    tune_swap_range_size = config.swap_range_size.getOrElse(10000)
-    tune_consumer_buffer = Option(config.consumer_buffer).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(256*1024)
-    tune_fast_delivery_rate = Option(config.fast_delivery_rate).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(1024*1024)
-    tune_catchup_enqueue_rate = Option(config.catchup_enqueue_rate).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(-1)
-    tune_max_enqueue_rate = Option(config.max_enqueue_rate).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(-1)
-
-    tune_quota = Option(config.quota).map(MemoryPropertyEditor.parse(_)).getOrElse(-1)
-
-    if( tune_persistent ) {
-      val record = QueueRecord(store_id, binding.binding_kind, binding.binding_data)
-      virtual_host.store.add_queue(record) { rc => Unit }
-    }
-
-    auto_delete_after = config.auto_delete_after.getOrElse(60*5)
-    if( auto_delete_after!= 0 ) {
-      // we don't auto delete explicitly configured queues,
-      // non destination queues, or unified queues.
-      if( config.unified.getOrElse(false) || !binding.isInstanceOf[QueueDomainQueueBinding]
|| !LocalRouter.is_wildcard_config(config) ) {
-        auto_delete_after = 0
-      }
-    }
-  }
-  dispatch_queue {
-    configure(config)
-  }
-
   var now = System.currentTimeMillis
 
   var enqueue_item_counter = 0L
@@ -246,6 +216,30 @@ class Queue(val router: LocalRouter, val
   var loaded_size = 0
   def swapped_in_size_max = this.producer_swapped_in.size_max + this.consumer_swapped_in.size_max
 
+  def configure(c:QueueDTO) = {
+    config = c
+    tune_persistent = virtual_host.store !=null && config.persistent.getOrElse(true)
+    tune_swap = tune_persistent && config.swap.getOrElse(true)
+    tune_swap_range_size = config.swap_range_size.getOrElse(10000)
+    tune_consumer_buffer = Option(config.consumer_buffer).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(256*1024)
+    tune_fast_delivery_rate = Option(config.fast_delivery_rate).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(1024*1024)
+    tune_catchup_enqueue_rate = Option(config.catchup_enqueue_rate).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(-1)
+    tune_max_enqueue_rate = Option(config.max_enqueue_rate).map(MemoryPropertyEditor.parse(_).toInt).getOrElse(-1)
+
+    tune_quota = Option(config.quota).map(MemoryPropertyEditor.parse(_)).getOrElse(-1)
+
+    auto_delete_after = config.auto_delete_after.getOrElse(30)
+    if( auto_delete_after!= 0 ) {
+      // we don't auto delete explicitly configured queues,
+      // non destination queues, or unified queues.
+      if( config.unified.getOrElse(false) || !binding.isInstanceOf[QueueDomainQueueBinding]
|| !LocalRouter.is_wildcard_config(config) ) {
+        auto_delete_after = 0
+      }
+    }
+  }
+  configure(config)
+
+
   def get_queue_metrics:DestMetricsDTO = {
     dispatch_queue.assertExecuting()
     val rc = new DestMetricsDTO
@@ -399,13 +393,13 @@ class Queue(val router: LocalRouter, val
 
   def check_idle {
     if (producers.isEmpty && all_subscriptions.isEmpty && queue_items==0
) {
-      if (idled_at==0) {
+      if (idled_at==0 && auto_delete_after!=0) {
         idled_at = now
-        if( auto_delete_after!=0 ) {
-          dispatch_queue.after(auto_delete_after, TimeUnit.SECONDS) {
-            if( now == idled_at ) {
-              router._destroy_queue(this)
-            }
+        val idled_at_start = idled_at
+        dispatch_queue.after(auto_delete_after, TimeUnit.SECONDS) {
+          // Have we been idle that whole time?
+          if( idled_at == idled_at_start ) {
+            router._destroy_queue(this)
           }
         }
       }
@@ -793,6 +787,7 @@ class Queue(val router: LocalRouter, val
       }
 
       swap_messages
+      check_idle
       schedule_periodic_maintenance
     }
   }

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala?rev=1234000&r1=1233999&r2=1234000&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Topic.scala
Fri Jan 20 16:53:51 2012
@@ -284,7 +284,7 @@ class Topic(val router:LocalRouter, val 
     import OptionSupport._
 
     config = config_updater()
-    auto_delete_after = config.auto_delete_after.getOrElse(60*5)
+    auto_delete_after = config.auto_delete_after.getOrElse(30)
     if( auto_delete_after!= 0 ) {
       // we don't auto delete explicitly configured destinations.
       if( !LocalRouter.is_wildcard_config(config) ) {

Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1234000&r1=1233999&r2=1234000&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md (original)
+++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Fri Jan
20 16:53:51 2012
@@ -267,7 +267,7 @@ memory.  Defaults to true.
   
 * `auto_delete_after`: If not set to `0` then the queue will automatically
   delete once there have been no consumers, producers or messages on it
-  for the configured number of seconds.  Defaults to 300 if not set.
+  for the configured number of seconds.  Defaults to 30 if not set.
   
 * `fast_delivery_rate`: The message delivery rate (in bytes/sec) at which             
   the queue considers the consumers fast enough to start slowing down enqueue
@@ -310,7 +310,7 @@ A `topic` element may be configured with
 
 * `auto_delete_after`: If not set to `0` then the topic will automatically
   delete once there have been no consumers or producers on it
-  for the configured number of seconds.  Defaults to 300 if not set.
+  for the configured number of seconds.  Defaults to 30 if not set.
 
 ##### Durable Subscriptions
 



Mime
View raw message