bugfixed org.vamsas.test.simpleclient.ArchiveClient and made VorbaId mechanism more...
[vamsas.git] / src / org / vamsas / test / simpleclient / ArchiveClient.java
index da555af..f0b2e16 100644 (file)
@@ -83,6 +83,10 @@ public class ArchiveClient extends IdFactory {
     if (vsess==null)
       throw new Error("ArchiveClient instance is invalid!.");
   }
+  /**
+   * set this to false if watch loop should end immediately
+   */
+  protected boolean watchForChange=true;
   public static int WATCH_SLEEP=300;
   /**
    * watch the document file for updates.
@@ -93,15 +97,16 @@ public class ArchiveClient extends IdFactory {
     valid();
     vsess.unLock(); // doh.
     FileWatcher watcher = new FileWatcher(vsess.getVamsasFile());
+    // watcher.setState();
+    watchForChange=true;
     long endtime=System.currentTimeMillis()+time;
     try {
       org.vamsas.client.simpleclient.Lock doclock;
-      //watcher.setState();
       do {
         doclock=watcher.getChangedState();
         if (doclock==null)
           Thread.sleep(WATCH_SLEEP);
-      } while (doclock==null && (time==0 || endtime>System.currentTimeMillis())); // tuning.
+      } while (watchForChange && doclock==null && (time==0 || endtime>System.currentTimeMillis())); // tuning.
       if (doclock==null)
         return null;
       else {