JAL-1333 more superposition debugging and deadlock avoidance
[jalview.git] / src / ext / edu / ucsf / rbvi / strucviz2 / ChimeraManager.java
index 95ea0d7..c0b3a39 100644 (file)
@@ -21,13 +21,13 @@ import ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads;
 public class ChimeraManager
 {
 
-  static private Process chimera;
+  private Process chimera;
 
-  static private ListenerThreads chimeraListenerThreads;
+  private ListenerThreads chimeraListenerThreads;
 
-  static private Map<Integer, ChimeraModel> currentModelsMap;
+  private Map<Integer, ChimeraModel> currentModelsMap;
 
-  private static Logger logger = LoggerFactory
+  private Logger logger = LoggerFactory
           .getLogger(ext.edu.ucsf.rbvi.strucviz2.ChimeraManager.class);
 
   private StructureManager structureManager;
@@ -38,7 +38,7 @@ public class ChimeraManager
     chimera = null;
     chimeraListenerThreads = null;
     currentModelsMap = new HashMap<Integer, ChimeraModel>();
-    
+
   }
 
   public List<ChimeraModel> getChimeraModels(String modelName)
@@ -627,7 +627,9 @@ public class ChimeraManager
     }
     return values;
   }
-  private volatile boolean busy=false;
+
+  private volatile boolean busy = false;
+
   /**
    * Send a command to Chimera.
    * 
@@ -647,11 +649,15 @@ public class ChimeraManager
     }
     while (busy)
     {
-      try {
+      try
+      {
         Thread.sleep(25);
-      } catch (InterruptedException q) {};
+      } catch (InterruptedException q)
+      {
+      }
+      ;
     }
-    busy=true;
+    busy = true;
     chimeraListenerThreads.clearResponse(command);
     String text = command.concat("\n");
     // System.out.println("send command to chimera: " + text);
@@ -667,16 +673,16 @@ public class ChimeraManager
       logger.warn("Unable to execute command: " + text);
       logger.warn("Exiting...");
       clearOnChimeraExit();
-      busy=false;
+      busy = false;
       return null;
     }
     if (!reply)
     {
-      busy=false;
+      busy = false;
       return null;
     }
     List<String> rsp = chimeraListenerThreads.getResponse(command);
-    busy=false;
+    busy = false;
     return rsp;
   }
 
@@ -685,4 +691,9 @@ public class ChimeraManager
     return structureManager;
   }
 
+  public boolean isBusy()
+  {
+    return busy;
+  }
+
 }