From: James Procter Date: Wed, 15 Nov 2023 15:02:43 +0000 (+0000) Subject: JAL-4222 bail if we wait too long for Jmol to save an image X-Git-Tag: Release_2_11_4_0~80^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fpatch%2FJAL-4222_100s_timeout_on_imagexport;p=jalview.git JAL-4222 bail if we wait too long for Jmol to save an image --- diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index ba4eb9c..0aa4878 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -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(