From: Ben Soares Date: Thu, 16 Nov 2023 10:41:03 +0000 (+0000) Subject: JAL-4238 ignore thread.sleeps in jalviewjs. Added a simple PAE example file. X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cd96215b471f122ef03946d5683055332fa5a5b8;p=jalview.git JAL-4238 ignore thread.sleeps in jalviewjs. Added a simple PAE example file. --- diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 1dd49a3..b451ac1 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -658,30 +658,36 @@ public class Commands } continue; } - try + + /** + * @j2sIgnore no Thread.sleep(long) + */ { - long tries = 1000; - while (structureViewer.isBusy() && tries > 0) + try { - Thread.sleep(25); - if (structureViewer.isBusy()) + int tries = 1000; + while (structureViewer.isBusy() && tries > 0) { - tries--; - Console.debug( - "Waiting for viewer for " + structureFilepath); + Thread.sleep(25); + if (structureViewer.isBusy()) + { + tries--; + Console.debug( + "Waiting for viewer for " + structureFilepath); + } } - } - if (tries == 0 && structureViewer.isBusy()) + if (tries == 0 && structureViewer.isBusy()) + { + addWarn("Gave up waiting for structure viewer to load file '" + + structureFile + + "'. Something may have gone wrong."); + } + } catch (Exception x) { - addWarn("Gave up waiting for structure viewer to load file '" - + structureFile - + "'. Something may have gone wrong."); + addError("Exception whilst waiting for structure viewer " + + structureFilepath, x); + isError = true; } - } catch (Exception x) - { - addError("Exception whilst waiting for structure viewer " - + structureFilepath, x); - isError = true; } // add StructureViewer to svMap list diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index ba4eb9c..8689aa7 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -357,11 +357,15 @@ public class AppJmol extends StructureViewerBase { try { - Console.debug("Waiting around for jmb notify."); waitTotal += waitFor; - - // Thread.sleep() throws an exception in JS - Thread.sleep(waitFor); + /** + * @j2sIgnore no Thread.sleep() + */ + { + Console.debug("Waiting around for jmb notify."); + // Thread.sleep() throws an exception in JS + Thread.sleep(waitFor); + } } catch (Exception e) { } diff --git a/utils/jalviewjs/site-resources/examples/pae-example.jvp b/utils/jalviewjs/site-resources/examples/pae-example.jvp new file mode 100644 index 0000000..e68a41a Binary files /dev/null and b/utils/jalviewjs/site-resources/examples/pae-example.jvp differ