service.asciidoc 935 B

12345678910111213141516171819202122232425
  1. [float]
  2. [[api-java-service]]
  3. === Service API
  4. The {watcher} `service` API allows the control the lifecycle of the {watcher}
  5. service. The following example starts the watcher service:
  6. [source,java]
  7. --------------------------------------------------
  8. WatcherServiceResponse watcherServiceResponse = watcherClient.prepareWatchService().start().get();
  9. --------------------------------------------------
  10. The following example stops the watcher service:
  11. [source,java]
  12. --------------------------------------------------
  13. WatcherServiceResponse watcherServiceResponse = watcherClient.prepareWatchService().stop().get();
  14. --------------------------------------------------
  15. The following example restarts the watcher service:
  16. [source,java]
  17. --------------------------------------------------
  18. WatcherServiceResponse watcherServiceResponse = watcherClient.prepareWatchService().restart().get();
  19. --------------------------------------------------