make splitting consumers/producers memory limit optional and off

by default

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@632666 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-03-01 22:31:26 +00:00
parent 767b548715
commit c427689dad
1 changed files with 45 additions and 7 deletions

View File

@ -161,6 +161,9 @@ public class BrokerService implements Service {
private boolean supportFailOver; private boolean supportFailOver;
private boolean clustered; private boolean clustered;
private Broker regionBroker; private Broker regionBroker;
private int producerSystemUsagePortion = 60;
private int consumerSystemUsagePortion = 40;
private boolean splitSystemUsageForProducersConsumers;
static { static {
@ -680,9 +683,14 @@ public class BrokerService implements Service {
*/ */
public SystemUsage getConsumerSystemUsage() throws IOException { public SystemUsage getConsumerSystemUsage() throws IOException {
if (this.consumerSystemUsaage == null) { if (this.consumerSystemUsaage == null) {
this.consumerSystemUsaage = new SystemUsage(getSystemUsage(), "Consumer"); if(splitSystemUsageForProducersConsumers) {
this.consumerSystemUsaage.getMemoryUsage().setUsagePortion(0.5f); this.consumerSystemUsaage = new SystemUsage(getSystemUsage(), "Consumer");
addService(this.consumerSystemUsaage); float portion = consumerSystemUsagePortion/100f;
this.consumerSystemUsaage.getMemoryUsage().setUsagePortion(portion);
addService(this.consumerSystemUsaage);
}else {
consumerSystemUsaage=getSystemUsage();
}
} }
return this.consumerSystemUsaage; return this.consumerSystemUsaage;
} }
@ -703,10 +711,15 @@ public class BrokerService implements Service {
* @throws IOException * @throws IOException
*/ */
public SystemUsage getProducerSystemUsage() throws IOException { public SystemUsage getProducerSystemUsage() throws IOException {
if (producerSystemUsage == null) { if (producerSystemUsage == null ) {
producerSystemUsage = new SystemUsage(getSystemUsage(), "Producer"); if (splitSystemUsageForProducersConsumers) {
producerSystemUsage.getMemoryUsage().setUsagePortion(0.45f); producerSystemUsage = new SystemUsage(getSystemUsage(), "Producer");
addService(producerSystemUsage); float portion = producerSystemUsagePortion/100f;
producerSystemUsage.getMemoryUsage().setUsagePortion(portion);
addService(producerSystemUsage);
}else {
producerSystemUsage=getSystemUsage();
}
} }
return producerSystemUsage; return producerSystemUsage;
} }
@ -1224,6 +1237,31 @@ public class BrokerService implements Service {
return getBroker().addDestination(getAdminConnectionContext(), destination); 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 // Implementation methods
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
/** /**