Class FileWatcherExecutorService
java.lang.Object
org.chenile.filewatch.handler.FileWatcherExecutorService
- All Implemented Interfaces:
DisposableBean, Lifecycle, Phased, SmartLifecycle
Coordinates file-watch registration, event-loop lifecycle and reconciliation scans.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExecutorServiceprivate FileProcessorprivate final FileSystemprivate Instantprivate static final org.slf4j.Loggerprivate final FileWatchPropertiesprivate final AtomicBooleanprivate final WatchServiceprivate final ExecutorServiceprivate Future<?> private final Map<WatchKey, FileWatcherExecutorService.WatchInfo> Fields inherited from interface SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionFileWatcherExecutorService(FileWatchProperties properties, FileSystem fileSystem) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcloseQuietly(Closeable closeable) voiddestroy()booleanbooleanprivate voidprivate voidvoidregisterWatch(FileWatchDefinition fileWatchDefinition) voidstart()voidvoidstop()private voidsubmitHeader(FileWatcherExecutorService.WatchInfo watchInfo, Path path) private voidprivate voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SmartLifecycle
getPhase, isPauseable, stop
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
properties
-
fileSystem
-
watcher
-
watcherExecutor
-
watchKeyToInfoMap
-
inFlightHeaders
-
running
-
lastReconciliationScan
-
executorService
-
fileProcessor
-
watcherTask
-
-
Constructor Details
-
FileWatcherExecutorService
-
-
Method Details
-
registerWatch
-
processExisting
-
startWatch
public void startWatch() -
start
-
watchLoop
private void watchLoop() -
reconcileIfDue
private void reconcileIfDue() -
submitHeader
-
waitForStability
private void waitForStability() -
stop
-
isRunning
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceSmartLifecycle
-
destroy
public void destroy()- Specified by:
destroyin interfaceDisposableBean
-
closeQuietly
-
CHENILE