From: gmungoc Date: Thu, 13 Oct 2016 09:56:37 +0000 (+0100) Subject: JAL-2044 increase Jmol file load timeout from 5 to 20 seconds X-Git-Tag: Release_2_10_1~24 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=40c7a94a2a48a1d0fd8791689e8393ff9be365d4 JAL-2044 increase Jmol file load timeout from 5 to 20 seconds --- diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 021a004..1c0dfe6 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -79,6 +79,9 @@ import javax.swing.event.MenuListener; public class AppJmol extends StructureViewerBase { + // ms to wait for Jmol to load files + private static final int JMOL_LOAD_TIMEOUT = 20000; + private static final String SPACE = " "; private static final String BACKSLASH = "\""; @@ -309,12 +312,10 @@ public class AppJmol extends StructureViewerBase jmb.setColourBySequence(true); setSize(400, 400); // probably should be a configurable/dynamic default here initMenus(); - worker = null; - { - addingStructures = false; - worker = new Thread(this); - worker.start(); - } + addingStructures = false; + worker = new Thread(this); + worker.start(); + this.addInternalFrameListener(new InternalFrameAdapter() { @Override @@ -551,7 +552,7 @@ public class AppJmol extends StructureViewerBase } // need to wait around until script has finished - int waitMax = 5000; // give up after 5 seconds + int waitMax = JMOL_LOAD_TIMEOUT; int waitFor = 35; int waitTotal = 0; while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled() @@ -568,7 +569,13 @@ public class AppJmol extends StructureViewerBase } if (waitTotal > waitMax) { - System.err.println("Timed out waiting for Jmol to load files"); + System.err + .println("Timed out waiting for Jmol to load files after " + + waitTotal + "ms"); +// System.err.println("finished: " + jmb.isFinishedInit() +// + "; loaded: " + Arrays.toString(jmb.getPdbFile()) +// + "; files: " + files.toString()); + jmb.getPdbFile(); break; } }