WatcherStop
Stops a registered watcher by name.
This operation does not remove the watcher from the registry; it only transitions the watcher to a stopped state. Use {@code watcherShutdownAll()} to stop and unregister.
Method Signature
WatcherStop(name=[string], force=[boolean])Arguments
Argument
Type
Required
Description
Default
name
string
true
The unique watcher name to stop.
force
boolean
false
Whether to force an immediate stop by interrupting the watch loop and closing the WatchService, which may cause event loss but allows for faster shutdown in unresponsive scenarios.
false
Examples
Stop a file watcher by name
watcherNew( "stopWatcher", getTempDirectory() );
watcherStop( "stopWatcher" );
writeOutput( "stopped" );
Result: stopped
Related
Last updated
Was this helpful?
