/[svn]/jlscp/trunk/src/org/linuxsampler/lscp/Client.java
ViewVC logotype

Diff of /jlscp/trunk/src/org/linuxsampler/lscp/Client.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2194 by iliev, Tue Jun 28 22:08:23 2011 UTC revision 2240 by iliev, Tue Aug 16 14:50:01 2011 UTC
# Line 30  import java.net.Socket; Line 30  import java.net.Socket;
30  import java.net.SocketTimeoutException;  import java.net.SocketTimeoutException;
31    
32  import java.util.ArrayList;  import java.util.ArrayList;
33    import java.util.TreeMap;
34  import java.util.Vector;  import java.util.Vector;
35  import java.util.logging.Level;  import java.util.logging.Level;
36  import java.util.logging.Logger;  import java.util.logging.Logger;
# Line 94  public class Client { Line 95  public class Client {
95    
96          private Vector<ResultSetEntry> resultSetQueue = new Vector<ResultSetEntry>();          private Vector<ResultSetEntry> resultSetQueue = new Vector<ResultSetEntry>();
97                    
98            /* Used for caching the engines' info */
99            private final TreeMap<String, SamplerEngine> engineMap = new TreeMap<String, SamplerEngine>();
100            
101          class EventThread extends Thread {          class EventThread extends Thread {
102                  private Vector<String> queue = new Vector<String>();                  private Vector<String> queue = new Vector<String>();
103                  private boolean terminate = false;                  private boolean terminate = false;
# Line 323  public class Client { Line 327  public class Client {
327                  if(sock != null) disconnect();                  if(sock != null) disconnect();
328                  if(getPrintOnlyMode()) return;                  if(getPrintOnlyMode()) return;
329                                    
330                    engineMap.clear();
331                    
332                  // Initializing LSCP event thread                  // Initializing LSCP event thread
333                  if(eventThread.isAlive()) {                  if(eventThread.isAlive()) {
334                          getLogger().warning("LSCP event thread already running!");                          getLogger().warning("LSCP event thread already running!");
# Line 441  public class Client { Line 447  public class Client {
447                          eventThread.terminate();                          eventThread.terminate();
448                          eventThread = new EventThread();                          eventThread = new EventThread();
449                  }                  }
450                    
451                    engineMap.clear();
452          }          }
453                    
454          /**          /**
# Line 3503  public class Client { Line 3511  public class Client {
3511           */           */
3512          private synchronized SamplerEngine          private synchronized SamplerEngine
3513          getEngineInfo(String engineName) throws IOException, LscpException, LSException {          getEngineInfo(String engineName) throws IOException, LscpException, LSException {
3514                  SamplerEngine se = new SamplerEngine();                  SamplerEngine se = engineMap.get(engineName);
3515                    if(se != null) return null;
3516                    
3517                    se = new SamplerEngine();
3518                  if(!retrieveInfo("GET ENGINE INFO " + engineName, se)) return null;                  if(!retrieveInfo("GET ENGINE INFO " + engineName, se)) return null;
3519                  se.setName(engineName);                  se.setName(engineName);
3520                    engineMap.put(engineName, se);
3521    
3522                  return se;                  return se;
3523          }          }

Legend:
Removed from v.2194  
changed lines
  Added in v.2240

  ViewVC Help
Powered by ViewVC