From 134a80e9a342881acac49de47a73eedfc6110d54 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 14 Nov 2005 18:32:20 +0000 Subject: [PATCH] start thread after watcher is added --- bindings/java/src/net/hyperic/sigar/cmd/Watch.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/cmd/Watch.java b/bindings/java/src/net/hyperic/sigar/cmd/Watch.java index 7cea6000..3592d964 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/Watch.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/Watch.java @@ -3,6 +3,7 @@ package net.hyperic.sigar.cmd; import java.io.File; import java.io.FileFilter; import java.io.IOException; +import java.util.ArrayList; import java.util.Date; import net.hyperic.sigar.Sigar; @@ -87,15 +88,14 @@ public class Watch { FileWatcherThread watcherThread = FileWatcherThread.getInstance(); - watcherThread.doStart(); - watcherThread.setInterval(1000); FileWatcher watcher = new FileWatcher(sigar) { public void onChange(FileInfo info) { System.out.println(info.getName() + - " Changed:\n" + info.diff()); + " Changed:\n" + + info.diff()); } public void onNotFound(FileInfo info) { @@ -120,6 +120,8 @@ public class Watch { watcherThread.add(watcher); + watcherThread.doStart(); + System.out.println("Press any key to stop"); try { System.in.read();