comments and version wget ping timeout fix for when www connection is unavailable...
authorjprocter <Jim Procter>
Tue, 29 Apr 2008 10:53:40 +0000 (10:53 +0000)
committerjprocter <Jim Procter>
Tue, 29 Apr 2008 10:53:40 +0000 (10:53 +0000)
src/jalview/bin/Cache.java
src/jalview/gui/Desktop.java
src/jalview/gui/SplashScreen.java

index 8d003ef..aed61f2 100755 (executable)
@@ -238,9 +238,11 @@ public class Cache
       {
         public void run()
         {
+          String orgtimeout = System.getProperty("sun.net.client.defaultConnectTimeout");
           String jnlpVersion = null;
           try
           {
+            System.setProperty("sun.net.client.defaultConnectTimeout", "5000");
             java.net.URL url = new java.net.URL(
                 "http://www.jalview.org/webstart/jalview.jnlp");
             BufferedReader in = new BufferedReader(new InputStreamReader(url.
@@ -264,6 +266,7 @@ public class Cache
             System.out.println(ex);
             jnlpVersion = getProperty("VERSION");
           }
+          System.setProperty("sun.net.client.defaultConnectTimeout", orgtimeout);
 
           setProperty("LATEST_VERSION", jnlpVersion);
         }
index ff01ed6..ed968f8 100755 (executable)
@@ -64,6 +64,11 @@ public class Desktop
    */
   public Desktop()
   {
+    /**
+     * A note to implementors. It is ESSENTIAL that any 
+     * activities that might block are spawned off as threads rather 
+     * than waited for during this constructor.
+     */
     instance = this;
     doVamsasClientCheck();
     doGroovyCheck();
@@ -121,10 +126,9 @@ public class Desktop
 
 
     this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));
+    // Spawn a thread that shows the splashscreen
+    new SplashScreen();     
 
-    /////////Add a splashscreen on startup
-    /////////Add a splashscreen on startup
-    new SplashScreen();
 
 
     discoverer = new jalview.ws.Discoverer(); // Only gets started if gui is displayed.
@@ -1217,7 +1221,8 @@ public class Desktop
   public void checkForQuestionnaire(String url)
   {
     UserQuestionnaireCheck jvq = new UserQuestionnaireCheck(url);
-    javax.swing.SwingUtilities.invokeLater(jvq);
+    //javax.swing.SwingUtilities.invokeLater(jvq);
+    new Thread(jvq).start();
   }
   /**
    * Proxy class for JDesktopPane which optionally 
index 8e0c55f..30cfa63 100755 (executable)
@@ -49,6 +49,21 @@ public class SplashScreen
    * ping the jalview version page then create and display the jalview splashscreen window.
    */
   void initSplashScreenWindow() {
+    addMouseListener(new MouseAdapter()
+    {
+      public void mousePressed(MouseEvent evt)
+      {
+        try
+        {
+          visible=false;
+          closeSplash();
+        }
+        catch (Exception ex)
+        {
+        }
+      }
+    });
+
     try
     {
       java.net.URL url = getClass().getResource("/images/logo.gif");
@@ -67,19 +82,6 @@ public class SplashScreen
     {
     }
 
-    addMouseListener(new MouseAdapter()
-    {
-      public void mousePressed(MouseEvent evt)
-      {
-        try
-        {
-          closeSplash();
-        }
-        catch (Exception ex)
-        {
-        }
-      }
-    });
 
     iframe = new JInternalFrame();
     iframe.setFrameIcon(null);