Class WrappedFileWatcher
- java.lang.Object
-
- org.apache.logging.log4j.core.util.AbstractWatcher
-
- org.apache.logging.log4j.core.util.WrappedFileWatcher
-
- All Implemented Interfaces:
FileWatcher,Watcher
public class WrappedFileWatcher extends AbstractWatcher implements FileWatcher
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.util.AbstractWatcher
AbstractWatcher.ReconfigurationRunnable
-
-
Field Summary
Fields Modifier and Type Field Description private longlastModifiedMillisprivate FileWatcherwatcher-
Fields inherited from interface org.apache.logging.log4j.core.util.Watcher
CATEGORY, ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description WrappedFileWatcher(FileWatcher watcher)WrappedFileWatcher(FileWatcher watcher, Configuration configuration, Reconfigurable reconfigurable, java.util.List<ConfigurationListener> configurationListeners, long lastModifiedMillis)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfileModified(java.io.File file)Called when aWatchManagerdetects that the givenFilechanged.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.booleanisModified()Periodically called to determine if the configuration has been modified.voidmodified()Called when the configuration has been modified.WatchernewWatcher(Reconfigurable reconfigurable, java.util.List<ConfigurationListener> listeners, long lastModifiedMillis)Creates a new Watcher by copying the original and using the new Reconfigurable and listeners.voidwatching(Source source)Called when the Watcher is registered.-
Methods inherited from class org.apache.logging.log4j.core.util.AbstractWatcher
getConfiguration, getSource
-
-
-
-
Field Detail
-
watcher
private final FileWatcher watcher
-
lastModifiedMillis
private volatile long lastModifiedMillis
-
-
Constructor Detail
-
WrappedFileWatcher
public WrappedFileWatcher(FileWatcher watcher, Configuration configuration, Reconfigurable reconfigurable, java.util.List<ConfigurationListener> configurationListeners, long lastModifiedMillis)
-
WrappedFileWatcher
public WrappedFileWatcher(FileWatcher watcher)
-
-
Method Detail
-
getLastModified
public 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- Specified by:
getLastModifiedin classAbstractWatcher- Returns:
- the time the source was last modified.
-
fileModified
public void fileModified(java.io.File file)
Description copied from interface:FileWatcherCalled when aWatchManagerdetects that the givenFilechanged.- Specified by:
fileModifiedin interfaceFileWatcher- Parameters:
file- the file that changed.- See Also:
WatchManager
-
isModified
public boolean isModified()
Description copied from interface:WatcherPeriodically called to determine if the configuration has been modified.- Specified by:
isModifiedin interfaceWatcher- Specified by:
isModifiedin classAbstractWatcher- Returns:
- true if the configuration was modified, false otherwise.
-
getListeners
public java.util.List<ConfigurationListener> getListeners()
Description copied from interface:WatcherReturns the list of listeners for this configuration.- Specified by:
getListenersin interfaceWatcher- Overrides:
getListenersin classAbstractWatcher- Returns:
- The list of listeners.
-
modified
public void modified()
Description copied from interface:WatcherCalled when the configuration has been modified.- Specified by:
modifiedin interfaceWatcher- Overrides:
modifiedin classAbstractWatcher
-
watching
public void watching(Source source)
Description copied from interface:WatcherCalled when the Watcher is registered.- Specified by:
watchingin interfaceWatcher- Overrides:
watchingin classAbstractWatcher- Parameters:
source- the Source that is being watched.
-
newWatcher
public Watcher newWatcher(Reconfigurable reconfigurable, java.util.List<ConfigurationListener> listeners, long lastModifiedMillis)
Description copied from interface:WatcherCreates a new Watcher by copying the original and using the new Reconfigurable and listeners.- Specified by:
newWatcherin interfaceWatcher- Parameters:
reconfigurable- The Reconfigurable.listeners- the listeners.lastModifiedMillis- The time the resource was last modified in milliseconds.- Returns:
- A new Watcher.
-
-