use mirrored file mtime for timestamp

This commit is contained in:
Doug MacEachern 2007-04-07 12:45:26 +00:00
parent 2329d9b7f5
commit 2ab9ea67a6
1 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,6 @@ import org.apache.log4j.Logger;
public class ProcFileMirror extends FileWatcher { public class ProcFileMirror extends FileWatcher {
private String proc; private String proc;
private long timestamp;
private long expire; private long expire;
private static final Logger log = private static final Logger log =
@ -41,7 +40,7 @@ public class ProcFileMirror extends FileWatcher {
public ProcFileMirror(Sigar sigar, String proc) { public ProcFileMirror(Sigar sigar, String proc) {
super(sigar); super(sigar);
this.timestamp = System.currentTimeMillis();
this.proc = proc; this.proc = proc;
this.expire = FileWatcherThread.DEFAULT_INTERVAL; this.expire = FileWatcherThread.DEFAULT_INTERVAL;
} }
@ -161,9 +160,10 @@ public class ProcFileMirror extends FileWatcher {
throws SigarException, throws SigarException,
SigarFileNotFoundException { SigarFileNotFoundException {
File dest = new File(getProcFile(info.getName()));
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if ((now - this.timestamp) > this.expire) {
this.timestamp = now; if ((now - dest.lastModified()) > this.expire) {
return true; return true;
} }
else { else {