mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
configurable max.simultaneous.builds option
This commit is contained in:
@@ -586,6 +586,7 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
|
||||
cmdLine.addParameter("-Xmx" + Registry.intValue("compiler.server.heap.size") + "m");
|
||||
cmdLine.addParameter("-Djava.awt.headless=true");
|
||||
|
||||
final String shouldGenerateIndex = System.getProperty(GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION);
|
||||
if (shouldGenerateIndex != null) {
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.GENERATE_CLASSPATH_INDEX_OPTION +"=" + shouldGenerateIndex);
|
||||
@@ -594,6 +595,12 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
if (pingInterval > 0L) {
|
||||
cmdLine.addParameter("-D" + GlobalOptions.PING_INTERVAL_MS_OPTION + "=" + pingInterval);
|
||||
}
|
||||
|
||||
final String maxBuilds = Registry.stringValue("compiler.server.max.simultaneous.builds");
|
||||
if (!StringUtil.isEmpty(maxBuilds)) {
|
||||
cmdLine.addParameter("-D" + GlobalOptions.MAX_SIMULTANEOUS_BUILDS_OPTION + "=" + maxBuilds);
|
||||
}
|
||||
|
||||
final String additionalOptions = Registry.stringValue("compiler.server.vm.options");
|
||||
if (!StringUtil.isEmpty(additionalOptions)) {
|
||||
final StringTokenizer tokenizer = new StringTokenizer(additionalOptions, " ", false);
|
||||
|
||||
@@ -10,4 +10,5 @@ public interface GlobalOptions {
|
||||
String HOSTNAME_OPTION = "localhost.name";
|
||||
String PING_INTERVAL_MS_OPTION = "server.ping.interval";
|
||||
String GENERATE_CLASSPATH_INDEX_OPTION = "generate.classpath.index";
|
||||
String MAX_SIMULTANEOUS_BUILDS_OPTION = "max.simultaneous.builds";
|
||||
}
|
||||
|
||||
@@ -35,11 +35,32 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class Server {
|
||||
public static final int DEFAULT_SERVER_PORT = 7777;
|
||||
private static final int MAX_SIMULTANEOUS_BUILD_SESSIONS = Math.max(2, Runtime.getRuntime().availableProcessors());
|
||||
public static final String SERVER_SUCCESS_START_MESSAGE = "Compile Server started successfully. Listening on port: ";
|
||||
public static final String SERVER_ERROR_START_MESSAGE = "Error starting Compile Server: ";
|
||||
private static final String LOG_FILE_NAME = "log.xml";
|
||||
private static final long PING_INTERVAL = Long.parseLong(System.getProperty(GlobalOptions.PING_INTERVAL_MS_OPTION, "-1"));
|
||||
|
||||
private static final long PING_INTERVAL;
|
||||
private static final int MAX_SIMULTANEOUS_BUILD_SESSIONS;
|
||||
static {
|
||||
long ping = -1L;
|
||||
try {
|
||||
ping = Long.parseLong(System.getProperty(GlobalOptions.PING_INTERVAL_MS_OPTION, "-1"));
|
||||
}
|
||||
catch (NumberFormatException ignored) {
|
||||
}
|
||||
PING_INTERVAL = ping;
|
||||
|
||||
int builds = 1;
|
||||
try {
|
||||
builds = Math.min(
|
||||
Integer.parseInt(System.getProperty(GlobalOptions.MAX_SIMULTANEOUS_BUILDS_OPTION, "1")),
|
||||
Runtime.getRuntime().availableProcessors()
|
||||
);
|
||||
}
|
||||
catch (NumberFormatException ignored) {
|
||||
}
|
||||
MAX_SIMULTANEOUS_BUILD_SESSIONS = builds;
|
||||
}
|
||||
|
||||
private final ChannelGroup myAllOpenChannels = new DefaultChannelGroup("compile-server");
|
||||
private final ChannelFactory myChannelFactory;
|
||||
|
||||
@@ -165,8 +165,6 @@ class ServerState {
|
||||
pd.incUsageCounter();
|
||||
}
|
||||
|
||||
final Project project = pd.project;
|
||||
|
||||
try {
|
||||
final CompileScope compileScope = createCompilationScope(buildType, pd, modules, artifacts, paths);
|
||||
final IncProjectBuilder builder = new IncProjectBuilder(pd, BuilderRegistry.getInstance(), builderParams, cs);
|
||||
|
||||
@@ -136,6 +136,9 @@ compiler.server.enabled.description=Enable out-of-process compilation
|
||||
compiler.server.heap.size=300
|
||||
compiler.server.heap.size.description=Heap size value in MB for the compile server process
|
||||
|
||||
compiler.server.max.simultaneous.builds=1
|
||||
compiler.server.max.simultaneous.builds.description=The max number of simultaneous build sessions. Increasing this value may require larger server heap size
|
||||
|
||||
compiler.server.vm.options=-ea
|
||||
compiler.server.vm.options.description=Additional options for compile server's VM
|
||||
|
||||
|
||||
Reference in New Issue
Block a user