Package org.apache.log4j.helpers
Class FileWatchdog
- java.lang.Object
-
- java.lang.Thread
-
- org.apache.log4j.helpers.FileWatchdog
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
PropertyConfigurator.PropertyWatchdog,XMLWatchdog
public abstract class FileWatchdog extends java.lang.ThreadChecks every now and then that a certain file has not changed. If it has, then call thedoOnChange()method.- Since:
- version 0.9.1
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_DELAYThe default delay between every file modification check, set to 60 seconds.protected longdelayThe delay to observe between every check.(package private) java.io.Filefileprotected java.lang.StringfilenameThe name of the file to observe for changes.(package private) booleaninterrupted(package private) longlastModified(package private) booleanwarnedAlready
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileWatchdog(java.lang.String fileName)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckAndConfigure()protected abstract voiddoOnChange()voidrun()voidsetDelay(long delayMillis)Sets the delay in milliseconds to observe between each check of the file changes.-
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, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
DEFAULT_DELAY
public static final long DEFAULT_DELAY
The default delay between every file modification check, set to 60 seconds.- See Also:
- Constant Field Values
-
filename
protected java.lang.String filename
The name of the file to observe for changes.
-
delay
protected long delay
The delay to observe between every check. By default setDEFAULT_DELAY.
-
file
java.io.File file
-
lastModified
long lastModified
-
warnedAlready
boolean warnedAlready
-
interrupted
boolean interrupted
-
-
Method Detail
-
checkAndConfigure
protected void checkAndConfigure()
-
doOnChange
protected abstract void doOnChange()
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
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
-
-