defaultConnectTimeout and NO REPONSE message
[jalview.git] / src / org / biojava / dasobert / das / DAS_FeatureRetrieve.java
index 9386bb2..99ded7d 100755 (executable)
@@ -82,6 +82,7 @@ public class DAS_FeatureRetrieve {
                 dasInStream    = open(url);
             } catch (Exception e ){
                 comeBackLater = -1;
+                System.out.println("NO RESPONSE FROM "+url);
                 logger.log(Level.FINE,"could not open connection to " + url,e);
                 return ;
             }
@@ -175,16 +176,20 @@ public class DAS_FeatureRetrieve {
     //logger.finest("opening "+url);
 
 
+    int timeout = 10000;
+    System.setProperty("sun.net.client.defaultConnectTimeout", timeout+"");
+    System.setProperty("sun.net.client.defaultReadTimeout", timeout+"");
+
     // use reflection to determine if get and set timeout methods for urlconnection are available
         // seems java 1.5 does not watch the System properties any longer...
         // and java 1.4 did not provide these...
     // for 1.4 see setSystemProperties
-    int timeout = 15000;
+
     try {
         // try to use reflection to set timeout property
         Class urlconnectionClass = Class.forName("java.net.HttpURLConnection");
 
-            Method setconnecttimeout = urlconnectionClass.getMethod (
+        Method setconnecttimeout = urlconnectionClass.getMethod (
                                      "setConnectTimeout", new Class [] {int.class}
                                      );
         setconnecttimeout.invoke(huc,new Object[] {new Integer(timeout)});