From: Jim Procter Date: Sun, 7 Jul 2013 11:39:23 +0000 (+0100) Subject: fix for JAL-1016 - wait around until we have a complete set of PDB filename mappings... X-Git-Tag: Jalview_2_9~229^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fd8ca94295a0f1fe8300112b90439d19f8cb683e;p=jalview.git fix for JAL-1016 - wait around until we have a complete set of PDB filename mappings available in Jmol --- diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 216c09e..4ac247c 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -326,7 +326,39 @@ public abstract class JalviewJmolBinding implements StructureListener, assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length); String[] files = getPdbFile(); + // check to see if we are still waiting for Jmol files + long starttime=System.currentTimeMillis(); + boolean waiting=true; + do { + waiting=false; + for (String file:files) + { + try { + // HACK - in Jalview 2.8 this call may not be threadsafe so we catch + // every possible exception + StructureMapping[] sm = ssm.getMapping(file); + if (sm == null || sm.length == 0) + { + waiting = true; + } + } catch (Exception x) + { + waiting = true; + } catch (Error q) + { + waiting = true; + } + } + // we wait around for a reasonable time before we give up + } while (waiting && System.currentTimeMillis()<(10000+1000*files.length+starttime)); + if (waiting) + { + System.err.println("RUNTIME PROBLEM: Jmol seems to be taking a long time to process all the structures."); + return; + } StringBuffer selectioncom = new StringBuffer(); + + // union of all aligned positions are collected together. for (int a = 0; a < _alignment.length; a++) {