}
}
}
if (brokerService != null && brokerService.getJobSchedulerStore() != null) {
JobSchedulerStore scheduler = brokerService.getJobSchedulerStore();
File dir = scheduler.getDirectory();
if (brokerService.isPersistent()) {
SystemUsage usage = brokerService.getSystemUsage();
if (dir != null && usage != null) {
String dirPath = dir.getAbsolutePath();
if (!dir.isAbsolute()) {
dir = new File(dirPath);
}
while (dir != null && !dir.isDirectory()) {
dir = dir.getParentFile();
}
long storeSize = scheduler.size();
long storeLimit = usage.getJobSchedulerUsage().getLimit();
long dirFreeSpace = dir.getUsableSpace();
if (storeSize != 0 && storeLimit != 0) {
int val = (int) ((storeSize * 100) / storeLimit);
if (val > 90) {
answer.add(new HealthStatus("org.apache.activemq.JobSchedulerLimit", "WARNING", "JobSchedulerMessage Store size is within " + val
+ "% of its limit", scheduler.toString()));
}
}
if ((storeLimit - storeSize) > dirFreeSpace) {
String message = "JobSchedulerStore limit is " + storeLimit / (1024 * 1024) + " mb, whilst the data directory: "
+ dir.getAbsolutePath() + " only has " + dirFreeSpace / (1024 * 1024) + " mb of usable space";
answer.add(new HealthStatus("org.apache.activemq.FreeDiskSpaceLeft", "WARNING", message, scheduler.toString()));
}
}
}
}