JAL-3070 use identity equivalence for workers rather than relying on equals not being...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 7 Oct 2019 07:56:36 +0000 (08:56 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 7 Oct 2019 07:56:36 +0000 (08:56 +0100)
src/jalview/workers/AlignCalcManager.java

index 6f0deab..3a3dc44 100644 (file)
@@ -22,6 +22,7 @@ package jalview.workers;
 
 import jalview.api.AlignCalcManagerI;
 import jalview.api.AlignCalcWorkerI;
+import jalview.bin.Cache;
 import jalview.datamodel.AlignmentAnnotation;
 
 import java.util.ArrayList;
@@ -90,7 +91,18 @@ public class AlignCalcManager implements AlignCalcManagerI
       }
       synchronized (upd)
       {
-        upd.add(worker);
+        // avoid use of 'Contains' in case
+        for (AlignCalcWorkerI _otherworker : upd)
+        {
+          if (_otherworker == upd)
+          {
+            Cache.log.debug(
+                    "Ignoring second call to notifyStart for worker "
+                            + worker);
+            return;
+          }
+        }
+          upd.add(worker);
       }
     }
   }