From a97a5c93ecd4b0ecd0c55ae2c58c6174c05190f0 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 5 Jun 2015 14:59:21 +0100 Subject: [PATCH] JAL-1622 Chimera command timeout increased to 5 secs (+minor changes) --- .../edu/ucsf/rbvi/strucviz2/ChimeraManager.java | 33 +++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java index 3ed27a3..80c8df5 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java @@ -221,7 +221,7 @@ public class ChimeraManager // // patch for Jalview - set model name in Chimera - // + // TODO: find a variant that works for sub-models sendChimeraCommand("setattr M name " + modelName + " #" + modelNumbers[0], false); // end patch for Jalview @@ -344,7 +344,7 @@ public class ChimeraManager public void stopListening() { - sendChimeraCommand("listen stop models; listen stop selection", false); + sendChimeraCommand("listen stop models ; listen stop selection ", false); } /** @@ -354,20 +354,8 @@ public class ChimeraManager */ public void startListening(String uri) { - sendChimeraCommand("listen start models url " + uri, false); - sendChimeraCommand("listen start select prefix SelectionChanged url " - + uri, false); - } - - /** - * Tell Chimera we have stopped listening on the given URI - * - * @param uri - */ - public void stopListening(String uri) - { - sendChimeraCommand("listen stop models url " + uri, false); - sendChimeraCommand("listen stop selection url " + uri, false); + sendChimeraCommand("listen start models url " + uri + + ";listen start select prefix SelectionChanged url " + uri, false); } /** @@ -543,6 +531,14 @@ public class ChimeraManager return launched; } + /** + * Launch Chimera, unless an instance linked to this object is already + * running. Returns true if chimera is successfully launched, or already + * running, else false. + * + * @param chimeraPaths + * @return + */ public boolean launchChimera(List chimeraPaths) { // Do nothing if Chimera is already launched @@ -760,6 +756,7 @@ public class ChimeraManager */ public List sendChimeraCommand(String command, boolean reply) { +// System.out.println("chimeradebug>> " + command); if (!isChimeraLaunched() || command == null || "".equals(command.trim())) { @@ -804,8 +801,6 @@ public class ChimeraManager */ protected List sendRestCommand(String command) { - // System.out.println("Rest: " + command); - // TODO start a separate thread to do this so we don't block? String restUrl = "http://127.0.0.1:" + this.chimeraRestPort + "/run"; List commands = new ArrayList(1); commands.add(new BasicNameValuePair("command", command)); @@ -814,7 +809,7 @@ public class ChimeraManager BufferedReader response = null; try { response = HttpClientUtils - .doHttpUrlPost(restUrl, commands, 100, 2000); + .doHttpUrlPost(restUrl, commands, 100, 5000); String line = ""; while ((line = response.readLine()) != null) { reply.add(line); -- 1.7.10.2