You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/09/26 10:59:39 UTC

svn commit: r699230 - /servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java

Author: gnodet
Date: Fri Sep 26 01:59:38 2008
New Revision: 699230

URL: http://svn.apache.org/viewvc?rev=699230&view=rev
Log:
Do not use the shell scripts to launch instances, as the pid will be the one from the script instead of the one from the java process

Modified:
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java?rev=699230&r1=699229&r2=699230&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java Fri Sep 26 01:59:38 2008
@@ -30,6 +30,7 @@
 
 import org.apache.servicemix.jpm.Process;
 import org.apache.servicemix.jpm.ProcessBuilderFactory;
+import org.apache.servicemix.jpm.impl.ScriptUtils;
 import org.apache.servicemix.kernel.gshell.admin.Instance;
 import org.apache.geronimo.gshell.common.io.PumpStreamHandler;
 import org.apache.geronimo.gshell.command.IO;
@@ -111,21 +112,20 @@
         if (this.process != null) {
             throw new IllegalStateException("Instance already started");
         }
-        /*
-        this.process = new ProcessBuilder()
-                            .directory(new File(name))
-                            .command(isWindows() ? "bin\\servicemix.bat" : "bin/servicemix", "server")
-                            .start();
-        IO io = ProxyIO.getIO();
-        this.handler = new PumpStreamHandler(new ByteArrayInputStream(new byte[0]),
-                                             io != null ? io.outputStream : new ByteArrayOutputStream(),
-                                             io != null ? io.errorStream : new ByteArrayOutputStream());
-        this.handler.attach(this.process);
-        this.handler.start();
-        */
+        String command = new File(System.getProperty("java.home"), "bin/java" + (ScriptUtils.isWindows() ? ".exe" : "")).getCanonicalPath()
+                + " -server -Xms128M -Xmx512M -Dcom.sun.management.jmxremote"
+                + " -Dservicemix.home=\"" + System.getProperty("servicemix.home") + "\""
+                + " -Dservicemix.base=\"" + new File(name).getCanonicalPath() + "\""
+                + " -Dservicemix.startLocalConsole=false"
+                + " -Dservicemix.startRemoteShell=true"
+                + " -classpath "
+                + new File(System.getProperty("servicemix.home"), "lib/servicemix.jar").getCanonicalPath()
+                + System.getProperty("path.separator")
+                + new File(System.getProperty("servicemix.home"), "lib/servicemix-jaas-boot.jar").getCanonicalPath()
+                + " org.apache.servicemix.kernel.main.Main";
         this.process = ProcessBuilderFactory.newInstance().newBuilder()
                         .directory(new File(name))
-                        .command(isWindows() ? "bin\\servicemix.bat server" : "bin/servicemix server")
+                        .command(command)
                         .start();
         this.service.saveState();
     }
@@ -176,16 +176,6 @@
         }
     }
 
-    private static final boolean windows;
-
-    static {
-        windows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1;
-    }
-
-    protected static boolean isWindows() {
-        return windows;
-    }
-
     protected static boolean deleteFile(File fileToDelete) {
         if (fileToDelete == null || !fileToDelete.exists()) {
             return true;