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

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1327379 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2012-04-18 05:34:22 +00:00
parent 7d47880f10
commit 61fdb188c8
1 changed files with 11 additions and 3 deletions

View File

@ -1713,13 +1713,21 @@ public class BrokerService implements Service {
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 Service {
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;