public class WatchManager extends AbstractLifeCycle
FileWatchers.FileWatcher,
ConfigurationSchedulerLifeCycle.StateDEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER| Constructor and Description |
|---|
WatchManager(ConfigurationScheduler scheduler) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkFiles() |
Map<Source,Watcher> |
getConfigurationWatchers()
Return the ConfigurationWaatchers.
|
UUID |
getId() |
int |
getIntervalSeconds()
Gets how often this manager checks for file modifications.
|
Map<File,FileWatcher> |
getWatchers()
Deprecated.
use getConfigurationWatchers.
|
boolean |
hasEventListeners() |
void |
reset()
Resets all file monitors to their current last modified time.
|
void |
reset(File file)
Resets the file monitor for the given file being watched to its current last modified time.
|
void |
reset(Source source)
Resets the configuration monitor for the given file being watched to its current last modified time.
|
void |
setIntervalSeconds(int intervalSeconds) |
void |
start() |
boolean |
stop(long timeout,
TimeUnit timeUnit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current
thread is interrupted, whichever happens first.
|
String |
toString() |
void |
unwatch(Source source)
Unwatches the given file.
|
void |
unwatchFile(File file)
Unwatches the given file.
|
void |
watch(Source source,
Watcher watcher)
Watches the given file.
|
void |
watchFile(File file,
FileWatcher fileWatcher)
Watches the given file.
|
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stoppublic WatchManager(ConfigurationScheduler scheduler)
public UUID getId()
public boolean hasEventListeners()
public void reset()
This allows you to start, stop, reset and start again a manager, without triggering file modified events if the a watched file has changed during the period of time when the manager was stopped.
public void reset(File file)
This allows you to start, stop, reset and start again a manager, without triggering file modified events if the given watched file has changed during the period of time when the manager was stopped.
file - the file for the monitor to reset.public void reset(Source source)
This allows you to start, stop, reset and start again a manager, without triggering file modified events if the given watched configuration has changed during the period of time when the manager was stopped.
source - the Source for the monitor to reset.public void setIntervalSeconds(int intervalSeconds)
public int getIntervalSeconds()
public void start()
start in interface LifeCyclestart in class AbstractLifeCyclepublic boolean stop(long timeout,
TimeUnit timeUnit)
LifeCycle2stop in interface LifeCycle2stop in class AbstractLifeCycletimeout - the maximum time to waittimeUnit - the time unit of the timeout argumentpublic void unwatchFile(File file)
file - the file to stop watching.public void unwatch(Source source)
source - the Source to stop watching.
the file to stop watching.public void checkFiles()
public void watchFile(File file, FileWatcher fileWatcher)
file - the file to watch.fileWatcher - the watcher to notify of file changes.public void watch(Source source, Watcher watcher)
source - the source to watch.watcher - the watcher to notify of file changes.public Map<File,FileWatcher> getWatchers()
public Map<Source,Watcher> getConfigurationWatchers()
Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.