org.littleshoot.util
Class LockedFileWatcher
java.lang.Object
java.util.TimerTask
org.littleshoot.util.LockedFileWatcher
- All Implemented Interfaces:
- Runnable
public abstract class LockedFileWatcher
- extends TimerTask
Utility class for detecting file changes. When a change is detected, this
class obtains an exclusive read/write lock on the file and notifies
subclasses of the change. The subclass MUST read the whole file and truncate
it to zero size.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LockedFileWatcher
public LockedFileWatcher(File file)
- Creates a new watcher for the specified file.
- Parameters:
file - The file to watch.
run
public final void run()
- Specified by:
run in interface Runnable- Specified by:
run in class TimerTask
onFileChange
protected abstract void onFileChange(FileChannel fc)
Copyright © 2011-2013 LittleShoot. All Rights Reserved.