activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1156715 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ apollo-util/src/main/scala/org/apache/activemq/apollo/util/ apollo-websi...
Date Thu, 11 Aug 2011 18:24:31 GMT
Author: chirino
Date: Thu Aug 11 18:24:31 2011
New Revision: 1156715

URL: http://svn.apache.org/viewvc?rev=1156715&view=rev
Log:
Fixes https://issues.apache.org/jira/browse/APLO-70 : Add per-destination queue quota

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/MemoryPropertyEditor.java
    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=1156715&r1=1156714&r2=1156715&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
Thu Aug 11 18:24:31 2011
@@ -120,6 +120,11 @@ class Queue(val router: LocalRouter, val
    */
   var tune_consumer_buffer = 0
 
+  /**
+   *  The max memory to allow this queue to grow to.
+   */
+  var tune_quota = -1L
+
   def configure(c:QueueDTO) = {
     config = c
     tune_persistent = virtual_host.store !=null && config.persistent.getOrElse(true)
@@ -127,6 +132,8 @@ class Queue(val router: LocalRouter, val
     tune_swap_range_size = config.swap_range_size.getOrElse(10000)
     tune_consumer_buffer = config.consumer_buffer.getOrElse(256*1024)
 
+    tune_quota = Option(config.quota).map(MemoryPropertyEditor.parse(_)).getOrElse(-1)
+
     if( tune_persistent ) {
       val record = new QueueRecord
       record.key = store_id
@@ -322,7 +329,7 @@ class Queue(val router: LocalRouter, val
 
     var refiller: Runnable = null
 
-    def full = (swapped_in_size >= swapped_in_size_max) || !service_state.is_started
+    def full = (swapped_in_size >= swapped_in_size_max) || !service_state.is_started ||
(tune_quota >=0 && queue_size > tune_quota)
 
     def offer(delivery: Delivery): Boolean = {
       if (full) {

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java?rev=1156715&r1=1156714&r2=1156715&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
Thu Aug 11 18:24:31 2011
@@ -87,6 +87,14 @@ public class QueueDTO extends StringIdDT
     public QueueAclDTO acl;
 
     /**
+     * The maximum amount of disk space the queue is allowed
+     * to grow to.  If not set then there is no limit.  You can
+     * use settings values like: 500mb or 1g just plain 1024000
+     */
+    @XmlAttribute(name="quota")
+    public String quota;
+
+    /**
      * To hold any other non-matching XML elements
      */
     @XmlAnyElement(lax=true)

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/MemoryPropertyEditor.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/MemoryPropertyEditor.java?rev=1156715&r1=1156714&r2=1156715&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/MemoryPropertyEditor.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/MemoryPropertyEditor.java
Thu Aug 11 18:24:31 2011
@@ -63,4 +63,9 @@ public class MemoryPropertyEditor extend
         return value != null ? value.toString() : "";
     }
 
+    public static long parse(String value) {
+        MemoryPropertyEditor pe = new MemoryPropertyEditor();
+        pe.setAsText(value);
+        return (Long)pe.getValue();
+    }
 }

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=1156715&r1=1156714&r2=1156715&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 Thu Aug
11 18:24:31 2011
@@ -264,6 +264,11 @@ memory.
   pointers to the actual messages. When not loaded, the batch is referenced
   as sequence range to conserve memory.
 
+* `quota` : The maximum amount of disk space the queue is allowed
+  to grow to.  If not set then there is no limit.  You can
+  use settings values like: `500mb` or `1g` just plain byte count
+  like `1024000`.
+
 ##### Topics
 
 When a new topic is first created in the broker, it's configuration will be



Mime
View raw message