Dasobert updates, labels and prefix changes
[jalview.git] / src / org / biojava / dasobert / das / FeatureThread.java
index 7435cdb..8c8923e 100755 (executable)
@@ -32,16 +32,16 @@ import org.biojava.dasobert.eventmodel.FeatureEvent;
 import org.biojava.dasobert.dasregistry.Das1Source;
 
 /** a thread that connects to a DAS - Feature service and gets the features
- *
+ * 
  * @author Andreas Prlic
  */
 
 
 
 public class FeatureThread
-    implements Runnable
+    implements Runnable 
 {
-
+    
     /** 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.
@@ -56,7 +56,7 @@ public class FeatureThread
     String ac ;
     List featureListeners;
     Thread thread;
-
+    
     public FeatureThread (String accessionCode, Das1Source dasSource) {
        this.dasSource = dasSource;
        this.ac = accessionCode;
@@ -66,7 +66,7 @@ public class FeatureThread
     public void addFeatureListener(FeatureListener li) {
        featureListeners.add(li);
     }
-
+    
     public void clearFeatureListeners() {
        featureListeners.clear();
     }
@@ -76,7 +76,7 @@ public class FeatureThread
        notify();
     }
 
-
+    
 
 
     public void run() {
@@ -89,21 +89,22 @@ public class FeatureThread
                cmd = new URL(queryString);
            } catch (MalformedURLException e ) {
                logger.warning("got MalformedURL from das source " +dasSource);
-               e.printStackTrace();
+               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;
+                   comeBackLater = -1; 
                    break;
-
+                
                }
                notifyComeBackLater(comeBackLater);
                // server is still calculating - asks us to come back later
@@ -113,9 +114,9 @@ public class FeatureThread
                    comeBackLater = -1;
                    break;
                }
-
+                
                ftmp.reload();
-               comeBackLater = ftmp.getComeBackLater();
+               comeBackLater = ftmp.getComeBackLater(); 
            }
 
            if ( ! (thread == me ) ) {
@@ -123,15 +124,15 @@ public class FeatureThread
            }
 
            List features = ftmp.get_features();
-
+        
            // a fallback mechanism to prevent DAS sources from bringing down spice
            if ( features.size() > MAX_NR_FEATURES){
                logger.warning("DAS source returned more than " + MAX_NR_FEATURES + "features. " +
                               " throwing away excess features at " +cmd);
                features = features.subList(0,MAX_NR_FEATURES);
            }
-
-
+      
+              
            // notify FeatureListeners
            Map[] feats = (Map[])features.toArray(new Map[features.size()]);
            notifyFeatureListeners(feats);
@@ -158,9 +159,9 @@ public class FeatureThread
             fi.newFeatures(fevent);
         }
     }
-
+    
  /** the Annotation server requested to be queried again in a while
-     *
+     * 
      * @param comeBackLater
      */
     private void notifyComeBackLater(int comeBackLater){
@@ -171,7 +172,7 @@ public class FeatureThread
             FeatureListener fi = (FeatureListener)fiter.next();
             fi.comeBackLater(event);
         }
-
+        
     }