Class WatchServiceListener

  • All Implemented Interfaces:
    AutoCloseable

    public final class WatchServiceListener
    extends Object
    implements AutoCloseable
    A wrapper around NIO's WatchService that uses the provided watch key to poll for changes, and calls listeners once an event occurs.

    Some deduplication is performed because Windows can be fairly spammy with its events, so one callback may receive multiple events at one time.

    Callback functions are Subscribers that take the WatchEvent as their parameter.

    Listening to a directory provides updates on the directory's immediate children, but does not listen recursively.

    Since:
    4.0.0