use mirrored file mtime for timestamp
This commit is contained in:
parent
2329d9b7f5
commit
2ab9ea67a6
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue