Class ResourceWatcherService

java.lang.Object
org.elasticsearch.watcher.ResourceWatcherService
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable

public class ResourceWatcherService
extends java.lang.Object
implements java.io.Closeable
Generic resource watcher service Other elasticsearch services can register their resource watchers with this service using add(ResourceWatcher) method. This service will call ResourceWatcher.checkAndNotify() method of all registered watcher periodically. The frequency of checks can be specified using resource.reload.interval setting, which defaults to 60s. The service can be disabled by setting resource.reload.enabled setting to false.
  • Field Details

    • ENABLED

      public static final Setting<java.lang.Boolean> ENABLED
    • RELOAD_INTERVAL_HIGH

      public static final Setting<org.elasticsearch.common.unit.TimeValue> RELOAD_INTERVAL_HIGH
    • RELOAD_INTERVAL_MEDIUM

      public static final Setting<org.elasticsearch.common.unit.TimeValue> RELOAD_INTERVAL_MEDIUM
    • RELOAD_INTERVAL_LOW

      public static final Setting<org.elasticsearch.common.unit.TimeValue> RELOAD_INTERVAL_LOW
  • Constructor Details

    • ResourceWatcherService

      public ResourceWatcherService​(Settings settings, ThreadPool threadPool)
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
    • add

      public <W extends ResourceWatcher> WatcherHandle<W> add​(W watcher) throws java.io.IOException
      Register new resource watcher that will be checked in default MEDIUM frequency
      Throws:
      java.io.IOException
    • add

      public <W extends ResourceWatcher> WatcherHandle<W> add​(W watcher, ResourceWatcherService.Frequency frequency) throws java.io.IOException
      Register new resource watcher that will be checked in the given frequency
      Throws:
      java.io.IOException
    • notifyNow

      public void notifyNow​(ResourceWatcherService.Frequency frequency)