JAL-2314 Tweaks to stop thread sync issues
[jalview.git] / src / jalview / ws / jws2 / Jws2Discoverer.java
index adca0fa..12a08a0 100644 (file)
@@ -172,6 +172,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
         {
         }
       }
+      aborted = false;
       Cache.log.debug("Old discovery thread has finished.");
     }
     running = true;
@@ -765,6 +766,22 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     return true;
   }
 
+  public boolean restart()
+  {
+    synchronized (this)
+    {
+      if (running)
+      {
+        aborted = true;
+      }
+      else
+      {
+        running = true;
+      }
+      return aborted;
+    }
+  }
+
   /**
    * Start a fresh discovery thread and notify the given object when we're
    * finished. Any known existing threads will be killed before this one is
@@ -775,6 +792,16 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
    */
   public Thread startDiscoverer(PropertyChangeListener changeSupport2)
   {
+    /*    if (restart())
+        {
+          return;
+        }
+        else
+        {
+          Thread thr = new Thread(this);
+          thr.start();
+        }
+       */
     if (isRunning())
     {
       setAborted(true);