public void unsubscribeJMXRuntimeEvent() { registrationListener.unsubscribeJMXRuntimeEvent(); }
/** * Starts the java process on the given Node uri * * @return process * @throws Throwable */ public final Process startProcess( String nodeBaseName, ProcessInitializer init, ProcessListener listener) throws Throwable { if (debug) { System.out.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Starting a new JVM"); outDebug.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Starting a new JVM"); } // Build java command javaCommandBuilder = new DummyJVMProcess(); javaCommandBuilder.setClassname(StartPARuntime.class.getName()); int deployID = new SecureRandom().nextInt(); listener.setDeployID(deployID); registrationListener = new RegistrationListener(listener, nodeBaseName); registrationListener.subscribeJMXRuntimeEvent(); javaCommandBuilder.setParameters( "-d " + deployID + " -c 1 -p " + RuntimeFactory.getDefaultRuntime().getURL()); javaCommandBuilder.setJvmOptions("-Dproactive.configuration=" + writeConfigFile()); // We build the process with a separate environment ProcessBuilder pb = new ProcessBuilder(); // Setting Environment variables Map<String, String> env = pb.environment(); // Specific to the extension init.initProcess(javaCommandBuilder, env); if (debug) { System.out.println("Starting Process:"); outDebug.println("Starting Process:"); System.out.println(javaCommandBuilder.getJavaCommand()); outDebug.println(javaCommandBuilder.getJavaCommand()); System.out.println("With Environment: {"); outDebug.println("With Environment: {"); for (Map.Entry<String, String> entry : pb.environment().entrySet()) { System.out.println(entry.getKey() + "=" + entry.getValue()); outDebug.println(entry.getKey() + "=" + entry.getValue()); } System.out.println("}"); outDebug.println("}"); } pb.command(javaCommandBuilder.getJavaCommand()); return pb.start(); }