Class WatchServiceSynchronizationStrategy
java.lang.Object
io.github.monsieurdoceo.filizer.storage.sync.strategy.WatchServiceSynchronizationStrategy
- All Implemented Interfaces:
FileSynchronizationStrategy
public final class WatchServiceSynchronizationStrategy
extends Object
implements FileSynchronizationStrategy
Synchronizes files using the Java WatchService API.
This strategy is intended for environments where file changes should be detected by the operating system instead of polling the last modified timestamp.
Unlike LastModifiedStrategy, synchronization is event-driven.
The watcher automatically reloads CustomFile instances whenever
their backing files are modified.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
WatchServiceSynchronizationStrategy
public WatchServiceSynchronizationStrategy()Creates a newWatchServiceSynchronizationStrategyinstance.This class does not require custom initialization.
-
-
Method Details
-
synchronize
Synchronizes the given file.No operation is required here because file synchronization is handled asynchronously by the WatchService.
- Specified by:
synchronizein interfaceFileSynchronizationStrategy- Parameters:
file- the file to synchronize
-