Package org.apache.log4j.helpers
Class FileWatchdog
java.lang.Object
java.lang.Thread
org.apache.log4j.helpers.FileWatchdog
- All Implemented Interfaces:
Runnable
Checks every now and then that a certain file has not changed. If it has, then call the
doOnChange() method.- Since:
- version 0.9.1
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default delay between every file modification check, set to 60 seconds.protected longThe delay to observe between every check.protected StringThe name of the file to observe for changes.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
DEFAULT_DELAY
public static final long DEFAULT_DELAYThe default delay between every file modification check, set to 60 seconds.- See Also:
-
filename
The name of the file to observe for changes. -
delay
protected long delayThe delay to observe between every check. By default setDEFAULT_DELAY.
-
-
Constructor Details
-
FileWatchdog
-
-
Method Details
-
checkAndConfigure
protected void checkAndConfigure() -
doOnChange
protected abstract void doOnChange() -
run
public void run() -
setDelay
public void setDelay(long delayMillis) Sets the delay in milliseconds to observe between each check of the file changes.- Parameters:
delayMillis- the delay in milliseconds
-