diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java index 557cd46d75..098ed9558c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java @@ -424,6 +424,11 @@ public class Queue extends BaseDestination implements Task { final ConnectionContext context = producerExchange.getConnectionContext(); synchronized (sendLock) { if (store != null && message.isPersistent()) { + if (isProducerFlowControl() && context.isProducerFlowControl() ) { + if (systemUsage.isSendFailIfNoSpace() && systemUsage.getStoreUsage().isFull()) { + throw new javax.jms.ResourceAllocationException("Usage Manager Store is Full"); + } + } while (!systemUsage.getStoreUsage().waitForSpace(1000)) { if (context.getStopping().get()) { throw new IOException( diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java index 740510ba91..90d737cada 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java @@ -385,6 +385,11 @@ public class Topic extends BaseDestination implements Task{ if (topicStore != null && message.isPersistent() && !canOptimizeOutPersistence()) { + if (isProducerFlowControl() && context.isProducerFlowControl() ) { + if (systemUsage.isSendFailIfNoSpace() && systemUsage.getStoreUsage().isFull()) { + throw new javax.jms.ResourceAllocationException("Usage Manager Store is Full"); + } + } while (!systemUsage.getStoreUsage().waitForSpace(1000)) { if (context.getStopping().get()) { throw new IOException("Connection closed, send aborted.");