only create one ProcFileMirror

This commit is contained in:
Doug MacEachern 2007-04-07 12:47:33 +00:00
parent 2ab9ea67a6
commit d53c03ec3d
1 changed files with 7 additions and 3 deletions

View File

@ -128,13 +128,16 @@ public class Watch {
} }
}; };
ProcFileMirror mirror =
new ProcFileMirror(sigar, "./proc");
watcher.setInterval(watcherThread.getInterval()); watcher.setInterval(watcherThread.getInterval());
mirror.setInterval(watcherThread.getInterval());
mirror.setExpire(60);
for (int i=0; i<args.length; i++) { for (int i=0; i<args.length; i++) {
String arg = args[i]; String arg = args[i];
if (arg.startsWith("/proc/")) { if (arg.startsWith("/proc/")) {
ProcFileMirror mirror =
new ProcFileMirror(sigar, "./proc");
watcherThread.add(mirror);
mirror.add(arg); mirror.add(arg);
arg = mirror.getProcFile(arg); arg = mirror.getProcFile(arg);
@ -148,6 +151,7 @@ public class Watch {
} }
} }
watcherThread.add(mirror);
watcherThread.add(watcher); watcherThread.add(watcher);
watcherThread.doStart(); watcherThread.doStart();