From 0b2df62f9d5ffe2b2fbfd3652a257f4234a9bf9f Mon Sep 17 00:00:00 2001 From: James Procter Date: Wed, 15 Nov 2023 15:02:43 +0000 Subject: [PATCH] JAL-4222 bail if we wait too long for Jmol to save an image --- src/jalview/gui/AppJmol.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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( -- 1.7.10.2