activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQ-5017
Date Tue, 04 Feb 2014 15:38:50 GMT
Updated Branches:
  refs/heads/trunk 5a80cee96 -> 9eb7fb906


https://issues.apache.org/jira/browse/AMQ-5017

Enforce max prefetch limit even in setAll and set inputstream using all
value.  

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

Branch: refs/heads/trunk
Commit: 9eb7fb9062651e0db04430ee497639b054dd6da3
Parents: 5a80cee
Author: Timothy Bish <tabish121@gmai.com>
Authored: Tue Feb 4 10:38:42 2014 -0500
Committer: Timothy Bish <tabish121@gmai.com>
Committed: Tue Feb 4 10:38:42 2014 -0500

----------------------------------------------------------------------
 .../apache/activemq/ActiveMQPrefetchPolicy.java | 52 +++++++++++---------
 1 file changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/9eb7fb90/activemq-client/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java
b/activemq-client/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java
index 629941b..4bde68e 100755
--- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java
+++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQPrefetchPolicy.java
@@ -17,6 +17,7 @@
 package org.apache.activemq;
 
 import java.io.Serializable;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -28,12 +29,13 @@ import org.slf4j.LoggerFactory;
  */
 @SuppressWarnings("serial")
 public class ActiveMQPrefetchPolicy extends Object implements Serializable {
+
     public static final int MAX_PREFETCH_SIZE = Short.MAX_VALUE;
     public static final int DEFAULT_QUEUE_PREFETCH = 1000;
     public static final int DEFAULT_QUEUE_BROWSER_PREFETCH = 500;
     public static final int DEFAULT_DURABLE_TOPIC_PREFETCH = 100;
-    public static final int DEFAULT_OPTIMIZE_DURABLE_TOPIC_PREFETCH=1000;
-    public static final int DEFAULT_INPUT_STREAM_PREFETCH=100;
+    public static final int DEFAULT_OPTIMIZE_DURABLE_TOPIC_PREFETCH = 1000;
+    public static final int DEFAULT_INPUT_STREAM_PREFETCH = 100;
     public static final int DEFAULT_TOPIC_PREFETCH = MAX_PREFETCH_SIZE;
 
     private static final Logger LOG = LoggerFactory.getLogger(ActiveMQPrefetchPolicy.class);
@@ -66,7 +68,8 @@ public class ActiveMQPrefetchPolicy extends Object implements Serializable
{
     }
 
     /**
-     * @param durableTopicPrefetch The durableTopicPrefetch to set.
+     * @param durableTopicPrefetch
+     *            The durableTopicPrefetch to set.
      */
     public void setDurableTopicPrefetch(int durableTopicPrefetch) {
         this.durableTopicPrefetch = getMaxPrefetchLimit(durableTopicPrefetch);
@@ -80,7 +83,8 @@ public class ActiveMQPrefetchPolicy extends Object implements Serializable
{
     }
 
     /**
-     * @param queuePrefetch The queuePrefetch to set.
+     * @param queuePrefetch
+     *            The queuePrefetch to set.
      */
     public void setQueuePrefetch(int queuePrefetch) {
         this.queuePrefetch = getMaxPrefetchLimit(queuePrefetch);
@@ -94,7 +98,8 @@ public class ActiveMQPrefetchPolicy extends Object implements Serializable
{
     }
 
     /**
-     * @param queueBrowserPrefetch The queueBrowserPrefetch to set.
+     * @param queueBrowserPrefetch
+     *            The queueBrowserPrefetch to set.
      */
     public void setQueueBrowserPrefetch(int queueBrowserPrefetch) {
         this.queueBrowserPrefetch = getMaxPrefetchLimit(queueBrowserPrefetch);
@@ -108,7 +113,8 @@ public class ActiveMQPrefetchPolicy extends Object implements Serializable
{
     }
 
     /**
-     * @param topicPrefetch The topicPrefetch to set.
+     * @param topicPrefetch
+     *            The topicPrefetch to set.
      */
     public void setTopicPrefetch(int topicPrefetch) {
         this.topicPrefetch = getMaxPrefetchLimit(topicPrefetch);
@@ -122,8 +128,8 @@ public class ActiveMQPrefetchPolicy extends Object implements Serializable
{
     }
 
     /**
-     * @param optimizeAcknowledgePrefetch The optimizeDurableTopicPrefetch to
-     *                set.
+     * @param optimizeAcknowledgePrefetch
+     *            The optimizeDurableTopicPrefetch to set.
      */
     public void setOptimizeDurableTopicPrefetch(int optimizeAcknowledgePrefetch) {
         this.optimizeDurableTopicPrefetch = optimizeAcknowledgePrefetch;
@@ -150,33 +156,35 @@ public class ActiveMQPrefetchPolicy extends Object implements Serializable
{
     }
 
     public void setAll(int i) {
-        this.durableTopicPrefetch = i;
-        this.queueBrowserPrefetch = i;
-        this.queuePrefetch = i;
-        this.topicPrefetch = i;
-        this.inputStreamPrefetch = 1;
-        this.optimizeDurableTopicPrefetch = i;
+        this.durableTopicPrefetch = getMaxPrefetchLimit(i);
+        this.queueBrowserPrefetch = getMaxPrefetchLimit(i);
+        this.queuePrefetch = getMaxPrefetchLimit(i);
+        this.topicPrefetch = getMaxPrefetchLimit(i);
+        this.inputStreamPrefetch = getMaxPrefetchLimit(i);
+        this.optimizeDurableTopicPrefetch = getMaxPrefetchLimit(i);
     }
 
+    @Deprecated
     public int getInputStreamPrefetch() {
         return inputStreamPrefetch;
     }
 
+    @Deprecated
     public void setInputStreamPrefetch(int inputStreamPrefetch) {
         this.inputStreamPrefetch = getMaxPrefetchLimit(inputStreamPrefetch);
     }
 
-    public boolean equals(Object object){
-        if (object instanceof ActiveMQPrefetchPolicy){
+    @Override
+    public boolean equals(Object object) {
+        if (object instanceof ActiveMQPrefetchPolicy) {
             ActiveMQPrefetchPolicy other = (ActiveMQPrefetchPolicy) object;
             return this.queuePrefetch == other.queuePrefetch &&
-            this.queueBrowserPrefetch == other.queueBrowserPrefetch &&
-            this.topicPrefetch == other.topicPrefetch &&
-            this.durableTopicPrefetch == other.durableTopicPrefetch &&
-            this.optimizeDurableTopicPrefetch == other.optimizeDurableTopicPrefetch &&
-            this.inputStreamPrefetch == other.inputStreamPrefetch;
+                   this.queueBrowserPrefetch == other.queueBrowserPrefetch &&
+                   this.topicPrefetch == other.topicPrefetch &&
+                   this.durableTopicPrefetch == other.durableTopicPrefetch &&
+                   this.optimizeDurableTopicPrefetch == other.optimizeDurableTopicPrefetch
&&
+                   this.inputStreamPrefetch == other.inputStreamPrefetch;
         }
         return false;
     }
-
 }


Mime
View raw message