From 44810964284bee17eb95b8ef3d20b3f760c17852 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Mon, 14 Sep 2015 19:46:57 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-5967 Updating temporary limit disk check to take into account space being used by the temporary store itself (cherry picked from commit 4f8d56aaf60f99abe643e79c6c4940a571289a86) --- .../org/apache/activemq/broker/BrokerService.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 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 5c120699d0..8ad56a7912 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 @@ -2023,16 +2023,19 @@ public class BrokerService implements Service { } long storeLimit = usage.getTempUsage().getLimit(); + long storeCurrent = usage.getTempUsage().getUsage(); while (tmpDir != null && !tmpDir.isDirectory()) { tmpDir = tmpDir.getParentFile(); } long dirFreeSpace = tmpDir.getUsableSpace(); - if (storeLimit > dirFreeSpace) { + if (storeLimit > (dirFreeSpace + storeCurrent)) { LOG.warn("Temporary Store limit is " + storeLimit / (1024 * 1024) + - " mb, whilst the temporary data directory: " + tmpDirPath + - " only has " + dirFreeSpace / (1024 * 1024) + " mb of usable space - resetting to maximum available " + - dirFreeSpace / (1024 * 1024) + " mb."); - usage.getTempUsage().setLimit(dirFreeSpace); + " mb (current temporary store usage is " + storeCurrent / (1024 * 1024) + + " mb). The temporary data directory: " + tmpDir.getAbsolutePath() + + " only has " + dirFreeSpace / (1024 * 1024) + + " mb of usable space - resetting to maximum available disk space: " + + (dirFreeSpace + storeCurrent) / (1024 * 1024) + " mb"); + usage.getTempUsage().setLimit(dirFreeSpace + storeCurrent); } if (isPersistent()) {