Package org.apache.hadoop.security.ssl
Class FileMonitoringTimerTask
java.lang.Object
java.util.TimerTask
org.apache.hadoop.security.ssl.FileMonitoringTimerTask
- All Implemented Interfaces:
Runnable
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 Summary
ConstructorsConstructorDescriptionFileMonitoringTimerTask(Path filePath, Consumer<Path> onFileChange, Consumer<Throwable> onChangeFailure) FileMonitoringTimerTask(List<Path> filePaths, Consumer<Path> onFileChange, Consumer<Throwable> onChangeFailure) Create file monitoring task to be scheduled using a standard JavaTimerinstance. -
Method Summary
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
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 whenonFileChangethrows an exception.
-
FileMonitoringTimerTask
public FileMonitoringTimerTask(List<Path> filePaths, Consumer<Path> onFileChange, Consumer<Throwable> onChangeFailure) Create file monitoring task to be scheduled using a standard JavaTimerinstance.- 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