public class ConfigurationFileWatcher extends AbstractWatcher implements FileWatcher
AbstractWatcher.ReconfigurationRunnable
Modifier and Type | Field and Description |
---|---|
private java.io.File |
file |
private long |
lastModifiedMillis |
CATEGORY, ELEMENT_TYPE
Constructor and Description |
---|
ConfigurationFileWatcher(Configuration configuration,
Reconfigurable reconfigurable,
java.util.List<ConfigurationListener> configurationListeners,
long lastModifiedMillis) |
Modifier and Type | Method and Description |
---|---|
void |
fileModified(java.io.File file)
Called when a
WatchManager detects that the given File changed. |
long |
getLastModified()
Returns the time the source was last modified or 0 if it is not available.
|
boolean |
isModified()
Periodically called to determine if the configuration has been modified.
|
Watcher |
newWatcher(Reconfigurable reconfigurable,
java.util.List<ConfigurationListener> listeners,
long lastModifiedMillis)
Creates a new Watcher by copying the original and using the new Reconfigurable and listeners.
|
void |
watching(Source source)
Called when the Watcher is registered.
|
getConfiguration, getListeners, getSource, modified
public ConfigurationFileWatcher(Configuration configuration, Reconfigurable reconfigurable, java.util.List<ConfigurationListener> configurationListeners, long lastModifiedMillis)
public long getLastModified()
Watcher
getLastModified
in interface Watcher
getLastModified
in class AbstractWatcher
public void fileModified(java.io.File file)
FileWatcher
WatchManager
detects that the given File
changed.fileModified
in interface FileWatcher
file
- the file that changed.WatchManager
public void watching(Source source)
Watcher
watching
in interface Watcher
watching
in class AbstractWatcher
source
- the Source that is being watched.public boolean isModified()
Watcher
isModified
in interface Watcher
isModified
in class AbstractWatcher
public Watcher newWatcher(Reconfigurable reconfigurable, java.util.List<ConfigurationListener> listeners, long lastModifiedMillis)
Watcher
newWatcher
in interface Watcher
reconfigurable
- The Reconfigurable.listeners
- the listeners.lastModifiedMillis
- The time the resource was last modified in milliseconds.