From 4aae950e66ed30fb4ac50dcbae4257bfda2518fc Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 2 Aug 2016 14:15:35 +0100 Subject: [PATCH] JAL-2068 reinstated false return value for notifyWorking (prevents multiple worker threads starting when new view created) * documentation for AlignCalcManagerI --- src/jalview/api/AlignCalcManagerI.java | 7 +++++-- src/jalview/workers/AlignCalcManager.java | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/jalview/api/AlignCalcManagerI.java b/src/jalview/api/AlignCalcManagerI.java index 9c7f9ab..18605b8 100644 --- a/src/jalview/api/AlignCalcManagerI.java +++ b/src/jalview/api/AlignCalcManagerI.java @@ -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); diff --git a/src/jalview/workers/AlignCalcManager.java b/src/jalview/workers/AlignCalcManager.java index 191e8c7..addb372 100644 --- a/src/jalview/workers/AlignCalcManager.java +++ b/src/jalview/workers/AlignCalcManager.java @@ -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 { -- 1.7.10.2