[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: JoramTests thread dumps...

timfox do-not-reply at jboss.com
Sat Mar 7 03:28:12 EST 2009


I don't know what happened to your commit, but the version I got from svn looks like this:


  | public void startServer() throws Exception
  |    {
  |       serverProcess = SpawnedVMSupport.spawnVM(SpawnedJMSServer.class.getName(), false);
  |       InputStreamReader isr = new InputStreamReader(serverProcess.getInputStream());
  |      
  |       final BufferedReader br = new BufferedReader(isr);
  |       String line = null;
  |       while ((line = br.readLine()) != null)
  |       {
  |          System.out.println(line);
  |          line.replace('|', '\n');
  |          if (line.startsWith("Listening for transport"))
  |          {
  |             continue;
  |          }
  |          else if ("OK".equals(line.trim()))
  |          {
  |             new Thread()
  |             {
  |                public void run()
  |                {
  |                   try
  |                   {
  |                      String line = null;
  |                      while ((line = br.readLine()) != null)
  |                      {
  |                         System.out.println("JoramServerOutput: " + line);
  |                      }
  |                   }
  |                   catch (Exception e)
  |                   {
  |                      e.printStackTrace();
  |                   }
  |                }
  |             }.start();
  |             return;
  |          }
  |          else
  |          {
  |             // something went wrong with the server, destroy it:
  |             serverProcess.destroy();
  |             throw new IllegalStateException("Unable to start the spawned server :" + line);
  |          }
  |       }
  |    }
  | 

You'd need to read stderr on a different thread to get it to work, also don't exit without joining the threads.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215922#4215922

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215922



More information about the jboss-dev-forums mailing list