JAL-4238 ignore thread.sleeps in jalviewjs. Added a simple PAE example file.
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 16 Nov 2023 10:41:03 +0000 (10:41 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 16 Nov 2023 10:41:03 +0000 (10:41 +0000)
src/jalview/bin/Commands.java
src/jalview/gui/AppJmol.java
utils/jalviewjs/site-resources/examples/pae-example.jvp [new file with mode: 0644]

index 1dd49a3..b451ac1 100644 (file)
@@ -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
index ba4eb9c..8689aa7 100644 (file)
@@ -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 (file)
index 0000000..e68a41a
Binary files /dev/null and b/utils/jalviewjs/site-resources/examples/pae-example.jvp differ