JAL-4222 bail if we wait too long for Jmol to save an image patch/JAL-4222_100s_timeout_on_imagexport
authorJames Procter <j.procter@dundee.ac.uk>
Wed, 15 Nov 2023 15:02:43 +0000 (15:02 +0000)
committerJames Procter <j.procter@dundee.ac.uk>
Wed, 15 Nov 2023 15:02:43 +0000 (15:02 +0000)
src/jalview/gui/AppJmol.java

index ba4eb9c..0aa4878 100644 (file)
@@ -503,10 +503,17 @@ public class AppJmol extends StructureViewerBase
                 }
               });
       runner.start();
+      long time = 0;
       do
       {
         Thread.sleep(25);
-      } while (runner.isAlive());
+      } while (runner.isAlive() && time++ < 4000);
+      if (time >= 4000)
+      {
+        runner.interrupt();
+        throw new ImageOutputException(
+                "Jmol took too long to export. Waited for 100 seconds.");
+      }
     } catch (Throwable e)
     {
       throw new ImageOutputException(