log.info("VM for Server " + index + " spawned");
log.trace("process: " + process);    final boolean verbose = false;  final BufferedReader rs = new BufferedReader(new InputStreamReader(process.getInputStream())); final BufferedReader re = new BufferedReader(new InputStreamReader(process.getErrorStream()));  new Thread(new Runnable() { public void run() { try { String line;  while((line = rs.readLine()) != null) { if (verbose) { System.out.println("SERVER " + i + " STDOUT: " + line); } } } catch(Exception e) { log.error("exception", e); } }  }, "Server " + i + " STDOUT reader thread").start();  new Thread(new Runnable() { public void run() { try { String line;  while((line = re.readLine()) != null) { if (verbose) { System.out.println("SERVER " + i + " STDERR: " + line); } } } catch(Exception e) { log.error("exception", e); } }  }, "Server " + i + " STDERR reader thread").start();      long maxWaitTime = 30; long startTime = System.currentTimeMillis(); Server s = null;  log.info("spawned server " + i + ", waiting for it to come online");  while(System.currentTimeMillis() - startTime < maxWaitTime * 1000) { s = acquireRemote(1, i, true); if (s != null) { break; } }  if (s == null) { log.error("Cannot contact newly spawned server " + i + ", most likely the attempt failed, timing out ..."); throw new Exception("Cannot contact newly spawned server " + i + ", most likely the attempt failed, timing out ..."); }  return s;
   public static synchronized void spawn(int index) throws Exception   {      if (servers[index] != null)      {         throw new Exception("The server " + index + " has been created already!");      }      // in the remote case, make sure the VM with the given index isn't already up      if (isRemote() && acquireRemote(3, index) != null)      {         throw new Exception("The remote server " + index + " seems to be already up!");      }      StringBuffer sb = new StringBuffer();      sb.append("java").append(' ');      sb.append("-Xmx512M").append(' ');      sb.append("-Dmodule.output=./../output").append(' ');      sb.append("-Dremote.test.suffix=-remote-").append(index).append(' ');      sb.append("-Dtest.server.index=").append(index).append(' ');      sb.append("-Dtest.bind.address=localhost").append(' ');      sb.append("-cp").append(' ').append(System.getProperty("java.class.path")).append(' ');      sb.append("org.jboss.test.messaging.tools.jmx.rmi.RMITestServer");      //System.out.println(sb.toString());      Runtime.getRuntime().exec(sb.toString());      killed[index] = false;      log.info("VM for Server " + index + " spawned");   }