activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r632666 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Sat, 01 Mar 2008 22:31:26 GMT
Author: rajdavies
Date: Sat Mar  1 14:31:26 2008
New Revision: 632666

URL: http://svn.apache.org/viewvc?rev=632666&view=rev
Log:
make splitting consumers/producers memory limit optional and off
by default

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=632666&r1=632665&r2=632666&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Sat Mar  1 14:31:26 2008
@@ -161,6 +161,9 @@
     private boolean supportFailOver;
     private boolean clustered;
     private Broker regionBroker;
+    private int producerSystemUsagePortion = 60;
+    private int consumerSystemUsagePortion = 40;
+    private boolean splitSystemUsageForProducersConsumers;
    
 
     static {
@@ -680,9 +683,14 @@
      */
     public SystemUsage getConsumerSystemUsage() throws IOException {
         if (this.consumerSystemUsaage == null) {
-            this.consumerSystemUsaage = new SystemUsage(getSystemUsage(), "Consumer");
-            this.consumerSystemUsaage.getMemoryUsage().setUsagePortion(0.5f);
-            addService(this.consumerSystemUsaage);
+            if(splitSystemUsageForProducersConsumers) {
+                this.consumerSystemUsaage = new SystemUsage(getSystemUsage(), "Consumer");
+                float portion = consumerSystemUsagePortion/100f;
+                this.consumerSystemUsaage.getMemoryUsage().setUsagePortion(portion);
+                addService(this.consumerSystemUsaage);
+            }else {
+                consumerSystemUsaage=getSystemUsage();
+            }
         }
         return this.consumerSystemUsaage;
     }
@@ -703,10 +711,15 @@
      * @throws IOException 
      */
     public SystemUsage getProducerSystemUsage() throws IOException {
-        if (producerSystemUsage == null) {
-            producerSystemUsage = new SystemUsage(getSystemUsage(), "Producer");
-            producerSystemUsage.getMemoryUsage().setUsagePortion(0.45f);
-            addService(producerSystemUsage);
+        if (producerSystemUsage == null ) {
+            if (splitSystemUsageForProducersConsumers) {
+                producerSystemUsage = new SystemUsage(getSystemUsage(), "Producer");
+                float portion = producerSystemUsagePortion/100f;
+                producerSystemUsage.getMemoryUsage().setUsagePortion(portion);
+                addService(producerSystemUsage);
+            }else {
+                producerSystemUsage=getSystemUsage();
+            }
         }
         return producerSystemUsage;
     }
@@ -1222,6 +1235,31 @@
      */
     public Destination getDestination(ActiveMQDestination destination) throws Exception {
         return getBroker().addDestination(getAdminConnectionContext(), destination);
+    }
+    
+    public int getProducerSystemUsagePortion() {
+        return producerSystemUsagePortion;
+    }
+
+    public void setProducerSystemUsagePortion(int producerSystemUsagePortion) {
+        this.producerSystemUsagePortion = producerSystemUsagePortion;
+    }
+
+    public int getConsumerSystemUsagePortion() {
+        return consumerSystemUsagePortion;
+    }
+
+    public void setConsumerSystemUsagePortion(int consumerSystemUsagePortion) {
+        this.consumerSystemUsagePortion = consumerSystemUsagePortion;
+    }
+
+    public boolean isSplitSystemUsageForProducersConsumers() {
+        return splitSystemUsageForProducersConsumers;
+    }
+
+    public void setSplitSystemUsageForProducersConsumers(
+            boolean splitSystemUsageForProducersConsumers) {
+        this.splitSystemUsageForProducersConsumers = splitSystemUsageForProducersConsumers;
     }
 
     // Implementation methods



Mime
View raw message