From 13e2ec04aa9db3447f2888c604d1479d0b901d56 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 21 Sep 2012 17:18:34 +0100 Subject: [PATCH] JAL-1171 refactor code to allow gui update for global status before and after results are parsed --- src/jalview/ws/AWSThread.java | 53 +++++++++++++++++++--------------- src/jalview/ws/jws2/MsaWSThread.java | 2 +- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/jalview/ws/AWSThread.java b/src/jalview/ws/AWSThread.java index 7300462..eea756e 100644 --- a/src/jalview/ws/AWSThread.java +++ b/src/jalview/ws/AWSThread.java @@ -163,30 +163,7 @@ public abstract class AWSThread extends Thread jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); } // Decide on overall state based on collected jobs[] states - if (jstate.running > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_RUNNING); - } - else if (jstate.queuing > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_QUEUING); - } - else - { - jobComplete = true; - if (jstate.finished > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); - } - else if (jstate.error > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); - } - else if (jstate.serror > 0) - { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); - } - } + updateGlobalStatus(jstate); if (!jobComplete) { try @@ -214,6 +191,34 @@ public abstract class AWSThread extends Thread } } + protected void updateGlobalStatus(JobStateSummary jstate) + { + if (jstate.running > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_RUNNING); + } + else if (jstate.queuing > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_QUEUING); + } + else + { + jobComplete = true; + if (jstate.finished > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK); + } + else if (jstate.error > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); + } + else if (jstate.serror > 0) + { + wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); + } + } + } + public AWSThread() { super(); diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index 393f475..86f5fbc 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -845,9 +845,9 @@ class MsaWSThread extends AWS2Thread implements WSClientI } else { - wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); wsInfo.setFinishedNoResults(); } + updateGlobalStatus(finalState); wsInfo.setProgressBar(null, progbar); } -- 1.7.10.2