Commit 79706eb5 authored by Costin Grigoras's avatar Costin Grigoras
Browse files

Don't force the process launching mechanism unless explicitly asked to

parent 4f96db2f
......@@ -156,11 +156,30 @@ public class ConfigUtils {
logger.log(Level.FINE, "Configuration loaded. Own logging configuration: " + (logging != null ? "true" : "false") + ", ML configuration detected: " + hasMLConfig());
}
/**
* @return forced process launching mechanism
*/
public static String getProcessLaunchMethod() {
if (getConfig().getb("forceFork", false))
return "FORK";
if (getConfig().getb("forceVFork", false))
return "VFORK";
if (getConfig().getb("forcePosixSpawn", false))
return "POSIX_SPAWN";
return null;
}
/**
* Explicitly configure JVM to use the FORK method of launching processes. WARNING: this is impacting a *lot* the performance. Only set it for leaf services that don't process much anyway.
*/
public static void switchToForkProcessLaunching() {
System.setProperty("jdk.lang.Process.launchMechanism", "FORK");
final String method = getProcessLaunchMethod();
if (method != null)
System.setProperty("jdk.lang.Process.launchMechanism", method);
}
static {
......@@ -903,7 +922,7 @@ public class ConfigUtils {
});
tokenFile.deleteOnExit();
fw.flush();
fw.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment