public boolean start ( String home , File options ) { File homeDirectory = new File ( home ) ; if ( ! homeDirectory . exists ( ) ) return false ; stop ( home ) ; try { List < String > command = new ArrayList < String > ( ) ; command . add ( java ) ; command . add ( "-Dironjacamar.home=" + home ) ; if ( options != null && options . exists ( ) ) command . add ( "-Dironjacamar.options=" + options . getAbsolutePath ( ) ) ; command . add ( "-Djava.net.preferIPv4Stack=true" ) ; command . add ( "-Djgroups.bind_addr=127.0.0.1" ) ; command . add ( "-Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl" ) ; command . add ( "-Dlog4j.defaultInitOverride=true" ) ; command . add ( "-jar" ) ; command . add ( home + "/bin/ironjacamar-sjc.jar" ) ; ProcessBuilder pb = new ProcessBuilder ( command ) ; pb . redirectErrorStream ( true ) ; Map < String , String > environment = pb . environment ( ) ; environment . put ( "ironjacamar.home" , home ) ; Process p = pb . start ( ) ; instances . put ( home , p ) ; return true ; } catch ( Throwable t ) { // Ignore } return false ; }
Start an instance