Package org.opensearch.watcher
Class ResourceWatcherService
java.lang.Object
org.opensearch.watcher.ResourceWatcherService
- All Implemented Interfaces:
Closeable
,AutoCloseable
Generic resource watcher service
Other opensearch 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
.
- Opensearch.api:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Frequency level to watch. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<W extends ResourceWatcher>
WatcherHandle<W> add
(W watcher) Register new resource watcher that will be checked in defaultMEDIUM
frequency<W extends ResourceWatcher>
WatcherHandle<W> add
(W watcher, ResourceWatcherService.Frequency frequency) Register new resource watcher that will be checked in the given frequencyvoid
close()
void
notifyNow
(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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
add
Register new resource watcher that will be checked in defaultMEDIUM
frequency- Throws:
IOException
-
add
public <W extends ResourceWatcher> WatcherHandle<W> add(W watcher, ResourceWatcherService.Frequency frequency) throws IOException Register new resource watcher that will be checked in the given frequency- Throws:
IOException
-
notifyNow
-