[jboss-cvs] JBoss Messaging SVN: r7414 - trunk/examples/common/src/org/jboss/common/example.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jun 20 16:35:58 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-20 16:35:58 -0400 (Sat, 20 Jun 2009)
New Revision: 7414

Modified:
   trunk/examples/common/src/org/jboss/common/example/JBMExample.java
   trunk/examples/common/src/org/jboss/common/example/SpawnedVMSupport.java
Log:
Individualizing Spawned output, to support easier debug in case of failures

Modified: trunk/examples/common/src/org/jboss/common/example/JBMExample.java
===================================================================
--- trunk/examples/common/src/org/jboss/common/example/JBMExample.java	2009-06-20 20:34:33 UTC (rev 7413)
+++ trunk/examples/common/src/org/jboss/common/example/JBMExample.java	2009-06-20 20:35:58 UTC (rev 7414)
@@ -164,6 +164,7 @@
       log.info("starting server with config '" + config + "' " + "logServerOutput " + logServerOutput);    
       servers[index] = SpawnedVMSupport.spawnVM(
             serverClasspath,
+            "JBMServer_" + index,
             SpawnedJBMServer.class.getName(),
             serverProps,
             logServerOutput,

Modified: trunk/examples/common/src/org/jboss/common/example/SpawnedVMSupport.java
===================================================================
--- trunk/examples/common/src/org/jboss/common/example/SpawnedVMSupport.java	2009-06-20 20:34:33 UTC (rev 7413)
+++ trunk/examples/common/src/org/jboss/common/example/SpawnedVMSupport.java	2009-06-20 20:35:58 UTC (rev 7414)
@@ -47,8 +47,20 @@
    // Attributes ----------------------------------------------------
 
    // Static --------------------------------------------------------
+   public static Process spawnVM(String classPath,
+                                 final String className,
+                                 final String vmargs,
+                                 final boolean logOutput,
+                                 final String success,
+                                 final String failure,
+                                 final String configDir,
+                                 final String... args) throws Exception
+   {
+      return spawnVM(classPath, "JBMServer", className, vmargs, logOutput, success, failure, configDir, args);
+   }
 
    public static Process spawnVM(String classPath,
+                                 final String logName,
                                  final String className,
                                  final String vmargs,
                                  final boolean logOutput,
@@ -79,7 +91,7 @@
          sb.append("-cp").append(" ").append(classPath).append(" ");
       }
 
-      //FIXME - not good to assume path separator
+      // FIXME - not good to assume path separator
       String libPath = "-Djava.library.path=" + System.getProperty("java.library.path", "./native/bin");
       if (isWindows)
       {
@@ -107,7 +119,7 @@
 
       ProcessLogger outputLogger = new ProcessLogger(logOutput,
                                                      process.getInputStream(),
-                                                     className,
+                                                     logName,
                                                      false,
                                                      success,
                                                      failure,
@@ -118,7 +130,7 @@
       // http://www.jboss.org/index.html?module=bb&op=viewtopic&t=151815
       ProcessLogger errorLogger = new ProcessLogger(true,
                                                     process.getErrorStream(),
-                                                    className,
+                                                    logName,
                                                     true,
                                                     success,
                                                     failure,
@@ -152,7 +164,7 @@
    {
       private InputStream is;
 
-      private String className;
+      private String logName;
 
       private final boolean print;
 
@@ -168,7 +180,7 @@
 
       ProcessLogger(final boolean print,
                     final InputStream is,
-                    final String className,
+                    final String logName,
                     boolean sendToErr,
                     String success,
                     String failure,
@@ -176,7 +188,7 @@
       {
          this.is = is;
          this.print = print;
-         this.className = className;
+         this.logName = logName;
          this.sendToErr = sendToErr;
          this.success = success;
          this.failure = failure;
@@ -208,11 +220,11 @@
                {
                   if (sendToErr)
                   {
-                     System.err.println("JBMServer err:" + line);
+                     System.err.println(logName + " err:" + line);
                   }
                   else
                   {
-                     System.out.println("JBMServer out:" + line);
+                     System.out.println(logName + " out:" + line);
                   }
                }
             }




More information about the jboss-cvs-commits mailing list