Class HttpWatcher
- java.lang.Object
-
- org.apache.logging.log4j.core.util.AbstractWatcher
-
- org.apache.logging.log4j.core.config.HttpWatcher
-
- All Implemented Interfaces:
Watcher
@Plugin(name="http", category="Watcher", elementType="watcher", printObject=true) @PluginAliases("https") public class HttpWatcher extends AbstractWatcher
-
-
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 static int
BUF_SIZE
private static java.lang.String
HTTP
private static java.lang.String
HTTPS
private long
lastModifiedMillis
private Logger
LOGGER
private static int
NOT_MODIFIED
private static int
OK
private SslConfiguration
sslConfiguration
private java.net.URL
url
-
Fields inherited from interface org.apache.logging.log4j.core.util.Watcher
CATEGORY, ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description HttpWatcher(Configuration configuration, Reconfigurable reconfigurable, java.util.List<ConfigurationListener> configurationListeners, long lastModifiedMillis)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.private byte[]
readStream(java.io.InputStream is)
private boolean
refreshConfiguration()
void
watching(Source source)
Called when the Watcher is registered.-
Methods inherited from class org.apache.logging.log4j.core.util.AbstractWatcher
getConfiguration, getListeners, getSource, modified
-
-
-
-
Field Detail
-
LOGGER
private Logger LOGGER
-
sslConfiguration
private SslConfiguration sslConfiguration
-
url
private java.net.URL url
-
lastModifiedMillis
private volatile long lastModifiedMillis
-
NOT_MODIFIED
private static final int NOT_MODIFIED
- See Also:
- Constant Field Values
-
OK
private static final int OK
- See Also:
- Constant Field Values
-
BUF_SIZE
private static final int BUF_SIZE
- See Also:
- Constant Field Values
-
HTTP
private static final java.lang.String HTTP
- See Also:
- Constant Field Values
-
HTTPS
private static final java.lang.String HTTPS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpWatcher
public HttpWatcher(Configuration configuration, Reconfigurable reconfigurable, java.util.List<ConfigurationListener> configurationListeners, long lastModifiedMillis)
-
-
Method Detail
-
getLastModified
public 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
- Specified by:
getLastModified
in classAbstractWatcher
- Returns:
- the time the source was last modified.
-
isModified
public boolean isModified()
Description copied from interface:Watcher
Periodically called to determine if the configuration has been modified.- Specified by:
isModified
in interfaceWatcher
- Specified by:
isModified
in classAbstractWatcher
- 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.- Specified by:
watching
in interfaceWatcher
- Overrides:
watching
in 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:Watcher
Creates a new Watcher by copying the original and using the new Reconfigurable and listeners.- Parameters:
reconfigurable
- The Reconfigurable.listeners
- the listeners.lastModifiedMillis
- The time the resource was last modified in milliseconds.- Returns:
- A new Watcher.
-
refreshConfiguration
private boolean refreshConfiguration()
-
readStream
private byte[] readStream(java.io.InputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
-