From 855419359cefbdb31be38510db121b17170af42d Mon Sep 17 00:00:00 2001 From: gtully Date: Thu, 31 Oct 2013 21:16:17 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-4832 - apply patch from Matthew Walker with thanks --- .../java/org/apache/activemq/broker/BrokerService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java index eecab9de33..575e313129 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -1908,14 +1908,16 @@ public class BrokerService implements Service { dir = dir.getParentFile(); } long storeLimit = usage.getStoreUsage().getLimit(); + long storeCurrent = usage.getStoreUsage().getUsage(); long dirFreeSpace = dir.getUsableSpace(); - if (storeLimit > dirFreeSpace) { + if (storeLimit > (dirFreeSpace + storeCurrent)) { LOG.warn("Store limit is " + storeLimit / (1024 * 1024) + - " mb, whilst the data directory: " + dir.getAbsolutePath() + + " mb (current store usage is " + storeCurrent / (1024 * 1024) + + " mb). The data directory: " + dir.getAbsolutePath() + " only has " + dirFreeSpace / (1024 * 1024) + " mb of usable space - resetting to maximum available disk space: " + - dirFreeSpace / (1024 * 1024) + " mb"); - usage.getStoreUsage().setLimit(dirFreeSpace); + (dirFreeSpace + storeCurrent) / (1024 * 1024) + " mb"); + usage.getStoreUsage().setLimit(dirFreeSpace + storeCurrent); } }