From fd8ca94295a0f1fe8300112b90439d19f8cb683e Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 7 Jul 2013 12:39:23 +0100 Subject: [PATCH] fix for JAL-1016 - wait around until we have a complete set of PDB filename mappings available in Jmol --- src/jalview/ext/jmol/JalviewJmolBinding.java | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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++) { -- 1.7.10.2