long totalFreeDiskSpace = 0;
long totalUsedDiskSpace = 0;
for (String path : paths) {
try {
FileSystemInfo fileSystemInfo = this.getResourceContext().getSystemInformation().getFileSystem(path);
if (!visitedMountPoints.contains(fileSystemInfo.getMountPoint())) {
visitedMountPoints.add(fileSystemInfo.getMountPoint());
//contrary to Sigar documentation this values are reported in MB and not bytes
totalDiskSpace += fileSystemInfo.getFileSystemUsage().getTotal();
totalFreeDiskSpace += fileSystemInfo.getFileSystemUsage().getFree();
totalUsedDiskSpace += fileSystemInfo.getFileSystemUsage().getUsed();
}
} catch (Exception e) {
log.error("Unable to determine file system usage information for data file location " + path, e);
}
}