java.io.Closeable
, java.lang.AutoCloseable
, LifecycleComponent
, Releasable
public class ResourceWatcherService extends AbstractLifecycleComponent
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
.Modifier and Type | Class | Description |
---|---|---|
static class |
ResourceWatcherService.Frequency |
Modifier and Type | Field | Description |
---|---|---|
static Setting<java.lang.Boolean> |
ENABLED |
|
static Setting<TimeValue> |
RELOAD_INTERVAL_HIGH |
|
static Setting<TimeValue> |
RELOAD_INTERVAL_LOW |
|
static Setting<TimeValue> |
RELOAD_INTERVAL_MEDIUM |
deprecationLogger, logger, settings
lifecycle
Constructor | Description |
---|---|
ResourceWatcherService(Settings settings,
ThreadPool threadPool) |
Modifier and Type | Method | Description |
---|---|---|
<W extends ResourceWatcher> |
add(W watcher) |
Register new resource watcher that will be checked in default
MEDIUM frequency |
<W extends ResourceWatcher> |
add(W watcher,
ResourceWatcherService.Frequency frequency) |
Register new resource watcher that will be checked in the given frequency
|
protected void |
doClose() |
|
protected void |
doStart() |
|
protected void |
doStop() |
|
void |
notifyNow() |
|
void |
notifyNow(ResourceWatcherService.Frequency frequency) |
logDeprecatedSetting, logRemovedSetting, nodeName
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
public static final Setting<java.lang.Boolean> ENABLED
@Inject public ResourceWatcherService(Settings settings, ThreadPool threadPool)
protected void doStart()
doStart
in class AbstractLifecycleComponent
protected void doStop()
doStop
in class AbstractLifecycleComponent
protected void doClose()
doClose
in class AbstractLifecycleComponent
public <W extends ResourceWatcher> WatcherHandle<W> add(W watcher) throws java.io.IOException
MEDIUM
frequencyjava.io.IOException
public <W extends ResourceWatcher> WatcherHandle<W> add(W watcher, ResourceWatcherService.Frequency frequency) throws java.io.IOException
java.io.IOException
public void notifyNow()
public void notifyNow(ResourceWatcherService.Frequency frequency)