JAL-2068 reinstated false return value for notifyWorking
authorJim Procter <jprocter@issues.jalview.org>
Tue, 2 Aug 2016 13:15:35 +0000 (14:15 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 2 Aug 2016 13:15:35 +0000 (14:15 +0100)
  (prevents multiple worker threads starting when new view created)
 * documentation for AlignCalcManagerI

src/jalview/api/AlignCalcManagerI.java
src/jalview/workers/AlignCalcManager.java

index 9c7f9ab..18605b8 100644 (file)
@@ -35,9 +35,12 @@ public interface AlignCalcManagerI
   void notifyStart(AlignCalcWorkerI worker);
 
   /**
-   * tell manager that worker is now processing data
+   * tell manager that a thread running worker's run() loop is ready to start
+   * processing data
    * 
    * @param worker
+   * @return true if worker should start processing, false if another thread is
+   *         in progress
    */
   boolean notifyWorking(AlignCalcWorkerI worker);
 
@@ -83,7 +86,7 @@ public interface AlignCalcManagerI
   /**
    * 
    * @param worker
-   * @return
+   * @return true if the worker is currently running
    */
   boolean isWorking(AlignCalcWorkerI worker);
 
index 191e8c7..addb372 100644 (file)
@@ -131,8 +131,7 @@ public class AlignCalcManager implements AlignCalcManagerI
     {
       if (inProgress.contains(worker))
       {
-        System.err.println("Implementation error: duplicate run of worker "
-                + worker);
+        return false; // worker is already working, so ask caller to wait around
       }
       else
       {