Class FileMonitoringTimerTask

java.lang.Object
java.util.TimerTask
org.apache.hadoop.security.ssl.FileMonitoringTimerTask
All Implemented Interfaces:
Runnable

@Private public class FileMonitoringTimerTask extends TimerTask
Implements basic logic to track when a file changes on disk and call the action passed to the constructor when it does. An exception handler can optionally also be specified in the constructor, otherwise any exception occurring during process will be logged using this class' logger.
  • Constructor Details

    • FileMonitoringTimerTask

      public FileMonitoringTimerTask(Path filePath, Consumer<Path> onFileChange, Consumer<Throwable> onChangeFailure)
      Parameters:
      filePath - The file to monitor.
      onFileChange - What to do when the file changes.
      onChangeFailure - What to do when onFileChange throws an exception.
    • FileMonitoringTimerTask

      public FileMonitoringTimerTask(List<Path> filePaths, Consumer<Path> onFileChange, Consumer<Throwable> onChangeFailure)
      Create file monitoring task to be scheduled using a standard Java Timer instance.
      Parameters:
      filePaths - The path to the file to monitor.
      onFileChange - The function to call when the file has changed.
      onChangeFailure - The function to call when an exception is thrown during the file change processing.
  • Method Details