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 java.lang.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 classAbstractWatcher.ReconfigurationRunnableHelper class for triggering a reconfiguration in a background thread.
-
Field Summary
Fields Modifier and Type Field Description private Configurationconfigurationprivate java.util.List<ConfigurationListener>configurationListenersprivate Reconfigurablereconfigurableprivate Sourcesourceprivate Log4jThreadFactorythreadFactory-
Fields inherited from interface org.apache.logging.log4j.core.util.Watcher
CATEGORY, ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description AbstractWatcher(Configuration configuration, Reconfigurable reconfigurable, java.util.List<ConfigurationListener> configurationListeners)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ConfigurationgetConfiguration()abstract longgetLastModified()Returns the time the source was last modified or 0 if it is not available.java.util.List<ConfigurationListener>getListeners()Returns the list of listeners for this configuration.SourcegetSource()Returns the Source being monitored.abstract booleanisModified()Periodically called to determine if the configuration has been modified.voidmodified()Called when the configuration has been modified.voidwatching(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
-
-
-
-
Field Detail
-
reconfigurable
private final Reconfigurable reconfigurable
-
configurationListeners
private final java.util.List<ConfigurationListener> configurationListeners
-
threadFactory
private final Log4jThreadFactory threadFactory
-
configuration
private final Configuration configuration
-
source
private Source source
-
-
Constructor Detail
-
AbstractWatcher
public AbstractWatcher(Configuration configuration, Reconfigurable reconfigurable, java.util.List<ConfigurationListener> configurationListeners)
-
-
Method Detail
-
getListeners
public java.util.List<ConfigurationListener> getListeners()
Description copied from interface:WatcherReturns the list of listeners for this configuration.- Specified by:
getListenersin interfaceWatcher- Returns:
- The list of listeners.
-
modified
public void modified()
Description copied from interface:WatcherCalled when the configuration has been modified.
-
getConfiguration
public Configuration getConfiguration()
-
getLastModified
public abstract long getLastModified()
Description copied from interface:WatcherReturns the time the source was last modified or 0 if it is not available.- Specified by:
getLastModifiedin interfaceWatcher- Returns:
- the time the source was last modified.
-
isModified
public abstract boolean isModified()
Description copied from interface:WatcherPeriodically called to determine if the configuration has been modified.- Specified by:
isModifiedin interfaceWatcher- Returns:
- true if the configuration was modified, false otherwise.
-
watching
public void watching(Source source)
Description copied from interface:WatcherCalled when the Watcher is registered.
-
-