- /** number of times the client tries to reconnect to the server if a "come back later" is returned.
- * the server should provide a reasonable estimation how long it will take him to create results.
- * if this number of requests is still not successfull, give up.
- */
- public static int MAX_COME_BACK_ITERATIONS = 5;
-
- public static int MAX_NR_FEATURES = 300;
-
- static Logger logger = Logger.getLogger("org.biojava.spice");
-
- Das1Source dasSource;
- String ac ;
- List featureListeners;
- Thread thread;
-
- public FeatureThread (String accessionCode, Das1Source dasSource) {
- this.dasSource = dasSource;
- this.ac = accessionCode;
- featureListeners = new ArrayList();
- }
-
- public void addFeatureListener(FeatureListener li) {
- featureListeners.add(li);
- }
-
- public void clearFeatureListeners() {
- featureListeners.clear();
- }
-
- public synchronized void stop(){
- thread = null;
- notify();
- }
-
-
-
-
- public void run() {
- Thread me = Thread.currentThread();
- while ( thread == me) {
- String url = dasSource.getUrl();
- String queryString = url + "features?segment="+ ac ;
- URL cmd = null ;
- try {
- cmd = new URL(queryString);
- } catch (MalformedURLException e ) {
- logger.warning("got MalformedURL from das source " +dasSource);
- e.printStackTrace();
- }
+ /** number of times the client tries to reconnect to the server if a "come back later" is returned.
+ * the server should provide a reasonable estimation how long it will take him to create results.
+ * if this number of requests is still not successfull, give up.
+ */
+ public static int MAX_COME_BACK_ITERATIONS = 5;
+
+ public static int MAX_NR_FEATURES = 300;
+
+ static Logger logger = Logger.getLogger("org.biojava.spice");
+
+ Das1Source dasSource;
+ String ac;
+ List featureListeners;
+ Thread thread;
+
+ public FeatureThread(String accessionCode, Das1Source dasSource)
+ {
+ this.dasSource = dasSource;
+ this.ac = accessionCode;
+ featureListeners = new ArrayList();
+ }
+
+ public void addFeatureListener(FeatureListener li)
+ {
+ featureListeners.add(li);
+ }
+
+ public void clearFeatureListeners()
+ {
+ featureListeners.clear();
+ }
+
+ public synchronized void stop()
+ {
+ thread = null;
+ notify();
+ }
+
+ public void run()
+ {
+ Thread me = Thread.currentThread();
+ while (thread == me)
+ {
+ String url = dasSource.getUrl();
+ String queryString = url + "features?segment=" + ac;
+ URL cmd = null;
+ try
+ {
+ cmd = new URL(queryString);
+ }
+ catch (MalformedURLException e)
+ {
+ logger.warning("got MalformedURL from das source " + dasSource);
+ e.printStackTrace();
+
+ }
+
+ logger.info("requesting features from " + cmd);
+ DAS_FeatureRetrieve ftmp = new DAS_FeatureRetrieve(cmd);
+
+ int comeBackLater = ftmp.getComeBackLater();
+ int securityCounter = 0;
+ while ( (thread == me) && (comeBackLater > 0))
+ {
+ securityCounter++;
+ if (securityCounter >= MAX_COME_BACK_ITERATIONS)
+ {
+ comeBackLater = -1;
+ break;