Class MacOsWatchThread
java.lang.Object
io.micronaut.scheduling.io.watch.DefaultWatchThread
io.micronaut.scheduling.io.watch.osx.MacOsWatchThread
- All Implemented Interfaces:
LifeCycle<DefaultWatchThread>
,Closeable
,AutoCloseable
@Replaces(DefaultWatchThread.class)
@Parallel
@Requires(property="micronaut.io.watch.enabled",value="true",defaultValue="true") @Requires(condition=FileWatchCondition.class) @Requires(classes={io.methvin.watchservice.MacOSXListeningWatchService.class,com.sun.jna.Library.class})
@Singleton
public class MacOsWatchThread
extends DefaultWatchThread
Replaces the
DefaultWatchThread
for Mac OS X to use native file watch.- Since:
- 1.1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorDescriptionMacOsWatchThread
(ApplicationEventPublisher eventPublisher, FileWatchConfiguration configuration, WatchService watchService) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Closes the watch service.registerPath
(@NonNull Path dir) Registers a patch to watch.Methods inherited from class io.micronaut.scheduling.io.watch.DefaultWatchThread
close, getWatchService, isRunning, start, stop
-
Constructor Details
-
MacOsWatchThread
public MacOsWatchThread(ApplicationEventPublisher eventPublisher, FileWatchConfiguration configuration, WatchService watchService) Default constructor.- Parameters:
eventPublisher
- The event publisherconfiguration
- the configurationwatchService
- the watch service
-
-
Method Details
-
registerPath
Description copied from class:DefaultWatchThread
Registers a patch to watch.- Overrides:
registerPath
in classDefaultWatchThread
- Parameters:
dir
- The directory to watch- Returns:
- The watch key
- Throws:
IOException
- if an error occurs.
-
closeWatchService
protected void closeWatchService()Description copied from class:DefaultWatchThread
Closes the watch service.- Overrides:
closeWatchService
in classDefaultWatchThread
-