Class AbstractWatcher
- java.lang.Object
-
- org.apache.logging.log4j.core.util.AbstractWatcher
-
- All Implemented Interfaces:
Watcher
- Direct Known Subclasses:
ConfigurationFileWatcher
,HttpWatcher
,WrappedFileWatcher
public abstract class AbstractWatcher extends Object implements Watcher
Watcher for configuration files. Causes a reconfiguration when a file changes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractWatcher.ReconfigurationRunnable
Helper class for triggering a reconfiguration in a background thread.
-
Field Summary
-
Fields inherited from interface org.apache.logging.log4j.core.util.Watcher
CATEGORY, ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description AbstractWatcher(Configuration configuration, Reconfigurable reconfigurable, List<ConfigurationListener> configurationListeners)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Configuration
getConfiguration()
abstract long
getLastModified()
Returns the time the source was last modified or 0 if it is not available.List<ConfigurationListener>
getListeners()
Returns the list of listeners for this configuration.Source
getSource()
Returns the Source being monitored.abstract boolean
isModified()
Periodically called to determine if the configuration has been modified.void
modified()
Called when the configuration has been modified.void
watching(Source source)
Called when the Watcher is registered.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.logging.log4j.core.util.Watcher
newWatcher
-
-
-
-
Constructor Detail
-
AbstractWatcher
public AbstractWatcher(Configuration configuration, Reconfigurable reconfigurable, List<ConfigurationListener> configurationListeners)
-
-
Method Detail
-
getListeners
public List<ConfigurationListener> getListeners()
Description copied from interface:Watcher
Returns the list of listeners for this configuration.- Specified by:
getListeners
in interfaceWatcher
- Returns:
- The list of listeners.
-
modified
public void modified()
Description copied from interface:Watcher
Called when the configuration has been modified.
-
getConfiguration
public Configuration getConfiguration()
-
getLastModified
public abstract long getLastModified()
Description copied from interface:Watcher
Returns the time the source was last modified or 0 if it is not available.- Specified by:
getLastModified
in interfaceWatcher
- Returns:
- the time the source was last modified.
-
isModified
public abstract boolean isModified()
Description copied from interface:Watcher
Periodically called to determine if the configuration has been modified.- Specified by:
isModified
in interfaceWatcher
- Returns:
- true if the configuration was modified, false otherwise.
-
watching
public void watching(Source source)
Description copied from interface:Watcher
Called when the Watcher is registered.
-
-