[jboss-cvs] JBoss Messaging SVN: r5993 - trunk/tests/joram-tests/src/org/jboss/test/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 4 08:39:46 EST 2009


Author: jmesnil
Date: 2009-03-04 08:39:45 -0500 (Wed, 04 Mar 2009)
New Revision: 5993

Modified:
   trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java
Log:
capture the System.in stream *before* printing OK to avoid a race condition

Modified: trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java
===================================================================
--- trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java	2009-03-04 13:36:17 UTC (rev 5992)
+++ trunk/tests/joram-tests/src/org/jboss/test/jms/SpawnedJMSServer.java	2009-03-04 13:39:45 UTC (rev 5993)
@@ -85,10 +85,13 @@
          env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
          serverManager.setContext(new InitialContext(env));
 
+         // create the reader before printing OK so that if the test is quick
+         // we will still capture the STOP message sent by the client
+         InputStreamReader isr = new InputStreamReader(System.in);
+         BufferedReader br = new BufferedReader(isr);
+
          System.out.println("OK");
 
-         InputStreamReader isr = new InputStreamReader(System.in);
-         BufferedReader br = new BufferedReader(isr);
          String line = null;
          while ((line = br.readLine()) != null)
          {




More information about the jboss-cvs-commits mailing list