private int min_valid_seqs;
@Override
- public void run()
+ public void run() throws Exception
{
- if (checkDone())
+ if (alignViewport.isClosed())
{
+ abortAndDestroy();
return;
}
if (!hasService())
{
- calcMan.workerComplete(this);
return;
}
{
jalview.bin.Cache.log.debug(
"Sequences for analysis service were null or not valid");
- calcMan.workerComplete(this);
return;
}
Cache.log.debug("Status now " + running.getState());
}
- if (calcMan.isPending(this) && isInteractiveUpdate())
- {
- Cache.log.debug("Analysis service job is stale. aborting.");
- // job has become stale.
- if (!finished) {
- finished = true;
- // cancel this job and yield to the new job
- try
- {
- if (cancellable
- && ((CancellableI) annotService).cancel(running))
- {
- System.err.println("Cancelled job: " + rslt);
- }
- else
- {
- System.err.println("FAILED TO CANCEL job: " + rslt);
- }
-
- } catch (Exception x)
- {
-
- }
- }
- rslt = running.getJobHandle();
- return;
- }
-
// pull any stats - some services need to flush log output before
// results are available
Cache.log.debug("Updating progress log for annotation service.");
try
{
- annotService.updateJobProgress(running);
+ annotService.updateJobProgress(running);
} catch (Throwable thr)
{
Cache.log.debug("Ignoring exception during progress update.",
System.err
.println("Blacklisting worker due to unexpected exception:");
x.printStackTrace();
+ throw new Exception(x);
} finally
{
- calcMan.workerComplete(this);
if (ap != null)
{
if (guiProgress != null && progressId != -1)
for (SequenceI sq : running.getSeqs())
{
if (!sq.getFeatures().hasFeatures()
- && (sq.getDBRefs() == null || sq.getDBRefs().length == 0))
+ && (sq.getDBRefs() == null || sq.getDBRefs().size() == 0))
{
continue;
}
}
}
- /**
- * notify manager that we have started, and wait for a free calculation slot
- *
- * @return true if slot is obtained and work still valid, false if another
- * thread has done our work for us.
- */
- protected boolean checkDone()
- {
- calcMan.notifyStart(this);
- ap.paintAlignment(false, false);
- while (!calcMan.notifyWorking(this))
- {
- if (calcMan.isWorking(this))
- {
- return true;
- }
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false, false);
- }
-
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- if (alignViewport.isClosed())
- {
- abortAndDestroy();
- return true;
- }
- return false;
- }
-
protected void updateOurAnnots(List<AlignmentAnnotation> ourAnnot)
{
List<AlignmentAnnotation> our = ourAnnots;