Extend WatchService
class and override callbacks (onEntryCreated()
, ...) to trigger related event.
There are two groups of callbacks:
-
J
group:onEntryCreatedJ()
,onEntryModifiedJ()
,onEntryDeletedJ()
,onOverflowedJ()
:These are default (un-manipulated) callbacks. They are invoked regularly when a related event occurs. You should override them when you wish trigger native
java.nio.file.WatchService
events.For example override: