mirror of https://github.com/apache/activemq.git
Changing memory limit flow control warning messages to be one time messages [http://issues.apache.org/activemq/browse/AMQ-2401]
This avoids performance penalty of constant logging since under normal circumstance producers will be going in and out of flow control frequently. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@817842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db3a021384
commit
4245c355dd
|
@ -51,6 +51,7 @@ public abstract class BaseDestination implements Destination {
|
||||||
protected SystemUsage systemUsage;
|
protected SystemUsage systemUsage;
|
||||||
protected MemoryUsage memoryUsage;
|
protected MemoryUsage memoryUsage;
|
||||||
private boolean producerFlowControl = false;
|
private boolean producerFlowControl = false;
|
||||||
|
protected boolean warnOnProducerFlowControl = true;
|
||||||
private int maxProducersToAudit = 1024;
|
private int maxProducersToAudit = 1024;
|
||||||
private int maxAuditDepth = 2048;
|
private int maxAuditDepth = 2048;
|
||||||
private boolean enableAudit = true;
|
private boolean enableAudit = true;
|
||||||
|
|
|
@ -412,11 +412,15 @@ public class Queue extends BaseDestination implements Task, UsageListener {
|
||||||
isFull(context, memoryUsage);
|
isFull(context, memoryUsage);
|
||||||
fastProducer(context, producerInfo);
|
fastProducer(context, producerInfo);
|
||||||
if (isProducerFlowControl() && context.isProducerFlowControl()) {
|
if (isProducerFlowControl() && context.isProducerFlowControl()) {
|
||||||
final String logMessage = "Usage Manager memory limit reached. Stopping producer (" + message.getProducerId() + ") to prevent flooding " + getActiveMQDestination().getQualifiedName() + "." +
|
if(warnOnProducerFlowControl) {
|
||||||
" See http://activemq.apache.org/producer-flow-control.html for more info";
|
warnOnProducerFlowControl = false;
|
||||||
LOG.info(logMessage);
|
LOG.info("Usage Manager memory limit reached on " +getActiveMQDestination().getQualifiedName() + ". Producers will be throttled to the rate at which messages are removed from this destination to prevent flooding it." +
|
||||||
|
" See http://activemq.apache.org/producer-flow-control.html for more info");
|
||||||
|
}
|
||||||
|
|
||||||
if (systemUsage.isSendFailIfNoSpace()) {
|
if (systemUsage.isSendFailIfNoSpace()) {
|
||||||
throw new javax.jms.ResourceAllocationException("SystemUsage memory limit reached");
|
throw new javax.jms.ResourceAllocationException("Usage Manager memory limit reached. Stopping producer (" + message.getProducerId() + ") to prevent flooding " +getActiveMQDestination().getQualifiedName() + "." +
|
||||||
|
" See http://activemq.apache.org/producer-flow-control.html for more info");
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can avoid blocking due to low usage if the producer is sending
|
// We can avoid blocking due to low usage if the producer is sending
|
||||||
|
|
|
@ -280,14 +280,20 @@ public class Topic extends BaseDestination implements Task{
|
||||||
if(memoryUsage.isFull()) {
|
if(memoryUsage.isFull()) {
|
||||||
isFull(context, memoryUsage);
|
isFull(context, memoryUsage);
|
||||||
fastProducer(context, producerInfo);
|
fastProducer(context, producerInfo);
|
||||||
|
|
||||||
if (isProducerFlowControl() && context.isProducerFlowControl()) {
|
if (isProducerFlowControl() && context.isProducerFlowControl()) {
|
||||||
final String logMessage = "Usage Manager memory limit reached. Stopping producer (" + message.getProducerId() + ") to prevent flooding " +getActiveMQDestination().getQualifiedName() + "." +
|
|
||||||
" See http://activemq.apache.org/producer-flow-control.html for more info";
|
if(warnOnProducerFlowControl) {
|
||||||
LOG.info(logMessage);
|
warnOnProducerFlowControl = false;
|
||||||
if (systemUsage.isSendFailIfNoSpace()) {
|
LOG.info("Usage Manager memory limit reached for " +getActiveMQDestination().getQualifiedName() + ". Producers will be throttled to the rate at which messages are removed from this destination to prevent flooding it." +
|
||||||
throw new javax.jms.ResourceAllocationException(logMessage);
|
" See http://activemq.apache.org/producer-flow-control.html for more info");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (systemUsage.isSendFailIfNoSpace()) {
|
||||||
|
throw new javax.jms.ResourceAllocationException("Usage Manager memory limit reached. Stopping producer (" + message.getProducerId() + ") to prevent flooding " +getActiveMQDestination().getQualifiedName() + "." +
|
||||||
|
" See http://activemq.apache.org/producer-flow-control.html for more info");
|
||||||
|
}
|
||||||
|
|
||||||
// We can avoid blocking due to low usage if the producer is sending
|
// We can avoid blocking due to low usage if the producer is sending
|
||||||
// a sync message or
|
// a sync message or
|
||||||
// if it is using a producer window
|
// if it is using a producer window
|
||||||
|
|
Loading…
Reference in New Issue