This second example covers the exciting world of the new WatchService API and its associated classes.
第二个例子展示了新watchservice API及其相关类的精彩世界。
Whether you hang onto this reference or not is up to you, because the WatchService returns the relevant WatchKey to you when an event is triggered.
是否挂接到这个引用由您决定,因为触发事件后,WatchService 会返回相关的 WatchKey。
Now that our Path is registered, we can check in with the WatchService at our convenience to see if any of the events we were interested in has occurred.
现在已注册了Path,我们可以用很方便的方式来检查WatchService,看是否发生了任何我们感兴趣的事件。
应用推荐