From: jprocter Date: Thu, 10 May 2012 16:24:09 +0000 (+0100) Subject: JAL-1085 - ensure sequence fetching client waits around until feature retrieval has... X-Git-Tag: Jalview_2_9~532^2~10 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9829b31986b83957217a6b9086665ef7be9b1c8c;p=jalview.git JAL-1085 - ensure sequence fetching client waits around until feature retrieval has finished before returning sequences for display. --- diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java index 2a5476b..bef6425 100644 --- a/src/jalview/ws/DasSequenceFeatureFetcher.java +++ b/src/jalview/ws/DasSequenceFeatureFetcher.java @@ -221,6 +221,7 @@ public class DasSequenceFeatureFetcher } private void _startFetching() { + running=true; new Thread(new FetchSeqFeatures()).start(); } class FetchSeqFeatures implements Runnable @@ -235,6 +236,7 @@ public class DasSequenceFeatureFetcher { public void run() { + running=true; new DBRefFetcher(sequences, af).fetchDBRefs(true); startFetching(); setGuiFetchComplete(); @@ -246,6 +248,7 @@ public class DasSequenceFeatureFetcher */ void startFetching() { + running=true; cancelled = false; startTime = System.currentTimeMillis(); if (af != null) @@ -546,10 +549,10 @@ public class DasSequenceFeatureFetcher } int sourcesRemaining = 0; - + private boolean running=false; private void setGuiFetchComplete() { - + running=false; if (!cancelled && af != null) { // only update the progress bar if we've completed the fetch normally @@ -879,4 +882,9 @@ public class DasSequenceFeatureFetcher return type.getContent(); } + public boolean isRunning() + { + return running; + } + } diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java index 4f053aa..5f18331 100644 --- a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java +++ b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java @@ -275,6 +275,16 @@ public class DasSequenceSource extends DbSourceProxyImpl implements { jalview.ws.DasSequenceFeatureFetcher dssf=new jalview.ws.DasSequenceFeatureFetcher(sqs, null, srcs, false, false, multiple); + while (dssf.isRunning()) + { + try { + Thread.sleep(200); + } catch (InterruptedException x) + { + + } + } + } catch (Exception x) { Cache.log