Package org.elasticsearch.watcher
Class ResourceWatcherService
java.lang.Object
org.elasticsearch.watcher.ResourceWatcherService
- All Implemented Interfaces:
Closeable,AutoCloseable
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.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<W extends ResourceWatcher>
WatcherHandle<W>add(W watcher)Register new resource watcher that will be checked in defaultMEDIUMfrequency<W extends ResourceWatcher>
WatcherHandle<W>add(W watcher, ResourceWatcherService.Frequency frequency)Register new resource watcher that will be checked in the given frequencyvoidclose()voidnotifyNow(ResourceWatcherService.Frequency frequency)
-
Field Details
-
ENABLED
-
RELOAD_INTERVAL_HIGH
-
RELOAD_INTERVAL_MEDIUM
-
RELOAD_INTERVAL_LOW
-
-
Constructor Details
-
ResourceWatcherService
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
add
Register new resource watcher that will be checked in defaultMEDIUMfrequency- Throws:
IOException
-
add
public <W extends ResourceWatcher> WatcherHandle<W> add(W watcher, ResourceWatcherService.Frequency frequency) throws IOExceptionRegister new resource watcher that will be checked in the given frequency- Throws:
IOException
-
notifyNow
-