Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 18 package org.apache.activemq; 19 20 import java.io.Serializable ; 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 25 32 public class ActiveMQPrefetchPolicy implements Serializable { 33 private static final Log log = LogFactory.getLog(ActiveMQPrefetchPolicy.class); 34 private static final int MAX_PREFETCH_SIZE = (Short.MAX_VALUE -1); 35 private int queuePrefetch; 36 private int queueBrowserPrefetch; 37 private int topicPrefetch; 38 private int durableTopicPrefetch; 39 private int optimizeDurableTopicPrefetch; 40 private int inputStreamPrefetch; 41 private int maximumPendingMessageLimit; 42 43 46 public ActiveMQPrefetchPolicy() { 47 this.queuePrefetch = 1000; 48 this.queueBrowserPrefetch = 500; 49 this.topicPrefetch = MAX_PREFETCH_SIZE; 50 this.durableTopicPrefetch = 100; 51 this.optimizeDurableTopicPrefetch=1000; 52 this.inputStreamPrefetch = 100; 53 } 54 55 58 public int getDurableTopicPrefetch() { 59 return durableTopicPrefetch; 60 } 61 62 65 public void setDurableTopicPrefetch(int durableTopicPrefetch) { 66 this.durableTopicPrefetch = getMaxPrefetchLimit(durableTopicPrefetch); 67 } 68 69 72 public int getQueuePrefetch() { 73 return queuePrefetch; 74 } 75 76 79 public void setQueuePrefetch(int queuePrefetch) { 80 this.queuePrefetch = getMaxPrefetchLimit(queuePrefetch); 81 } 82 83 86 public int getQueueBrowserPrefetch() { 87 return queueBrowserPrefetch; 88 } 89 90 93 public void setQueueBrowserPrefetch(int queueBrowserPrefetch) { 94 this.queueBrowserPrefetch = getMaxPrefetchLimit(queueBrowserPrefetch); 95 } 96 97 100 public int getTopicPrefetch() { 101 return topicPrefetch; 102 } 103 104 107 public void setTopicPrefetch(int topicPrefetch) { 108 this.topicPrefetch = getMaxPrefetchLimit(topicPrefetch); 109 } 110 111 114 public int getOptimizeDurableTopicPrefetch(){ 115 return optimizeDurableTopicPrefetch; 116 } 117 118 121 public void setOptimizeDurableTopicPrefetch(int optimizeAcknowledgePrefetch){ 122 this.optimizeDurableTopicPrefetch=optimizeAcknowledgePrefetch; 123 } 124 125 public int getMaximumPendingMessageLimit() { 126 return maximumPendingMessageLimit; 127 } 128 129 133 public void setMaximumPendingMessageLimit(int maximumPendingMessageLimit) { 134 this.maximumPendingMessageLimit = maximumPendingMessageLimit; 135 } 136 137 138 private int getMaxPrefetchLimit(int value) { 139 int result = Math.min(value, MAX_PREFETCH_SIZE); 140 if (result < value) { 141 log.warn("maximum prefetch limit has been reset from " + value + " to " + MAX_PREFETCH_SIZE); 142 } 143 return result; 144 } 145 146 public void setAll(int i) { 147 this.durableTopicPrefetch=i; 148 this.queueBrowserPrefetch=i; 149 this.queuePrefetch=i; 150 this.topicPrefetch=i; 151 this.inputStreamPrefetch=1; 152 this.optimizeDurableTopicPrefetch=i; 153 } 154 155 public int getInputStreamPrefetch() { 156 return inputStreamPrefetch; 157 } 158 159 public void setInputStreamPrefetch(int inputStreamPrefetch) { 160 this.inputStreamPrefetch = getMaxPrefetchLimit(inputStreamPrefetch); 161 } 162 163 164 } 165
| Popular Tags
|