Class DiskChecker


  • public class DiskChecker
    extends java.lang.Object
    Class that provides utility functions for checking disk problems.
    • Constructor Summary

      Constructors 
      Constructor Description
      DiskChecker​(float threshold, float warnThreshold)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float checkDir​(java.io.File dir)
      Create the directory if it doesn't exist.
      (package private) float checkDiskFull​(java.io.File dir)
      Checks the disk space available.
      float getDiskUsageThreshold()  
      float getDiskUsageWarnThreshold()  
      long getTotalDiskSpace​(java.util.List<java.io.File> dirs)
      Calculate the total amount of disk space in all of the ledger directories put together.
      float getTotalDiskUsage​(java.util.List<java.io.File> dirs)
      calculates and returns the disk usage factor in the provided list of dirs.
      long getTotalFreeSpace​(java.util.List<java.io.File> dirs)
      Calculate the total amount of free space available in all of the ledger directories put together.
      (package private) void setDiskSpaceThreshold​(float diskSpaceThreshold, float diskUsageWarnThreshold)
      Set the disk space threshold.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DiskChecker

        public DiskChecker​(float threshold,
                           float warnThreshold)
    • Method Detail

      • getTotalFreeSpace

        public long getTotalFreeSpace​(java.util.List<java.io.File> dirs)
                               throws java.io.IOException
        Calculate the total amount of free space available in all of the ledger directories put together.
        Returns:
        freeDiskSpace in bytes
        Throws:
        java.io.IOException
      • getTotalDiskSpace

        public long getTotalDiskSpace​(java.util.List<java.io.File> dirs)
                               throws java.io.IOException
        Calculate the total amount of disk space in all of the ledger directories put together.
        Returns:
        totalDiskSpace in bytes
        Throws:
        java.io.IOException
      • getTotalDiskUsage

        public float getTotalDiskUsage​(java.util.List<java.io.File> dirs)
                                throws java.io.IOException
        calculates and returns the disk usage factor in the provided list of dirs.
        Parameters:
        dirs - list of directories
        Returns:
        disk usage factor in the provided list of dirs
        Throws:
        java.io.IOException
      • setDiskSpaceThreshold

        void setDiskSpaceThreshold​(float diskSpaceThreshold,
                                   float diskUsageWarnThreshold)
        Set the disk space threshold.
        Parameters:
        diskSpaceThreshold -
      • getDiskUsageThreshold

        public float getDiskUsageThreshold()
      • getDiskUsageWarnThreshold

        public float getDiskUsageWarnThreshold()