git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1235325 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-01-24 16:14:37 +00:00
parent dbc661fd9b
commit 7b90f4178f
1 changed files with 28 additions and 17 deletions

View File

@ -1678,29 +1678,40 @@ public class BrokerService implements Service {
SystemUsage usage = getSystemUsage(); SystemUsage usage = getSystemUsage();
long memLimit = usage.getMemoryUsage().getLimit(); long memLimit = usage.getMemoryUsage().getLimit();
long jvmLimit = Runtime.getRuntime().maxMemory(); long jvmLimit = Runtime.getRuntime().maxMemory();
if (memLimit > jvmLimit){ if (memLimit > jvmLimit) {
LOG.error("Memory Usage for the Broker (" + memLimit/(1024*1024) + " mb) is more than the maximum available for the JVM: " + jvmLimit/(1024*1024) + " mb" ); LOG.error("Memory Usage for the Broker (" + memLimit / (1024 * 1024) +
" mb) is more than the maximum available for the JVM: " +
jvmLimit / (1024 * 1024) + " mb");
} }
if (getPersistenceAdapter() != null){ if (getPersistenceAdapter() != null) {
File dir = getPersistenceAdapter().getDirectory(); File dir = getPersistenceAdapter().getDirectory();
if (dir != null){ if (dir != null) {
long storeLimit = usage.getStoreUsage().getLimit(); long storeLimit = usage.getStoreUsage().getLimit();
long dirFreeSpace = dir.getFreeSpace(); long dirFreeSpace = dir.getFreeSpace();
if (storeLimit > dirFreeSpace){ 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"); LOG.warn("Store limit is " + storeLimit / (1024 * 1024) +
" mb, whilst the data directory: " + dir.getAbsolutePath() +
" only has " + dirFreeSpace / (1024 * 1024) + " mb of free space");
} }
} }
} }
File tmpDir = getTmpDataDirectory(); File tmpDir = getTmpDataDirectory();
if (tmpDir != null){ if (tmpDir != null) {
String tmpDirPath = tmpDir.getAbsolutePath(); String tmpDirPath = tmpDir.getAbsolutePath();
if (!tmpDir.isAbsolute()) {
tmpDir = new File(tmpDirPath);
}
long storeLimit = usage.getTempUsage().getLimit(); long storeLimit = usage.getTempUsage().getLimit();
while (tmpDir != null && tmpDir.isDirectory()== false){ while (tmpDir != null && tmpDir.isDirectory() == false) {
tmpDir = tmpDir.getParentFile(); tmpDir = tmpDir.getParentFile();
} }
long dirFreeSpace = tmpDir.getUsableSpace(); long dirFreeSpace = tmpDir.getUsableSpace();
if (storeLimit > dirFreeSpace){ 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"); 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");
} }
} }
} }