activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r1327379 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Date Wed, 18 Apr 2012 05:34:22 GMT
Author: rajdavies
Date: Wed Apr 18 05:34:22 2012
New Revision: 1327379

URL: http://svn.apache.org/viewvc?rev=1327379&view=rev
Log:
For https://issues.apache.org/jira/browse/AMQ-3573 In junit tests -  fixed warning messages
can be generated for not enough disk space if the directory doesn't exist

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1327379&r1=1327378&r2=1327379&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Wed Apr 18 05:34:22 2012
@@ -1713,13 +1713,21 @@ public class BrokerService implements Se
         if (getPersistenceAdapter() != null) {
             PersistenceAdapter adapter = getPersistenceAdapter();
             File dir = adapter.getDirectory();
+            String dirPath = dir.getAbsolutePath();
             if (dir != null) {
+                if (!dir.isAbsolute()) {
+                    dir = new File(dirPath);
+                }
+
+                while (dir != null && dir.isDirectory() == false) {
+                    dir = dir.getParentFile();
+                }
                 long storeLimit = usage.getStoreUsage().getLimit();
-                long dirFreeSpace = dir.getFreeSpace();
+                long dirFreeSpace = dir.getUsableSpace();
                 if (storeLimit > dirFreeSpace) {
                     LOG.warn("Store limit is " + storeLimit / (1024 * 1024) +
                              " mb, whilst the data directory: " + dir.getAbsolutePath() +
-                             " only has " + dirFreeSpace / (1024 * 1024) + " mb of free space");
+                             " only has " + dirFreeSpace / (1024 * 1024) + " mb of usable
space");
                 }
             }
 
@@ -1758,7 +1766,7 @@ public class BrokerService implements Se
             if (storeLimit > dirFreeSpace) {
                 LOG.error("Temporary Store limit is " + storeLimit / (1024 * 1024) +
                           " mb, whilst the temporary data directory: " + tmpDirPath +
-                          " only has " + dirFreeSpace / (1024 * 1024) + " mb of free space");
+                          " only has " + dirFreeSpace / (1024 * 1024) + " mb of usable space");
             }
 
             long maxJournalFileSize;



Mime
View raw message