From 0397ab0da286ca71ae6f6841e047083aa2d83ec2 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Fri, 31 Oct 2014 20:13:10 +0100 Subject: [PATCH] do not start excessive number of pre-loaded processes --- .../compiler/server/BuildManager.java | 19 ++++++++----------- .../server/BuildMessageDispatcher.java | 8 -------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 8d58ec8be56e..247948ded4fa 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -546,11 +546,9 @@ public class BuildManager implements ApplicationComponent{ runCommand(new Runnable() { @Override public void run() { - LOG.info("Cancelling preloaded process for project " + projectPath); Pair, OSProcessHandler> pair = takePreloadedProcess(projectPath); if (pair != null) { final RequestFuture future = pair.first; - LOG.info("Cancelling preloaded process, sessionID=" + future.getRequestID()); myMessageDispatcher.cancelSession(future.getRequestID()); // waiting for preloaded process from project's task queue guarantees no build is started for this project // until this one gracefully exits and closes all its storages @@ -561,9 +559,6 @@ public class BuildManager implements ApplicationComponent{ } }); } - else { - LOG.info("takePreloadedProcess() returned null"); - } } }); } @@ -752,12 +747,14 @@ public class BuildManager implements ApplicationComponent{ if (Registry.is("compiler.process.preload") && !project.isDisposed()) { runCommand(new Runnable() { public void run() { - try { - final Future, OSProcessHandler>> preloadResult = launchPreloadedBuildProcess(project, projectTaskQueue); - myPreloadedBuilds.put(projectPath, preloadResult); - } - catch (Exception e) { - LOG.info("Error pre-loading build process for project " + projectPath, e); + if (!myPreloadedBuilds.containsKey(projectPath)) { + try { + final Future, OSProcessHandler>> preloadResult = launchPreloadedBuildProcess(project, projectTaskQueue); + myPreloadedBuilds.put(projectPath, preloadResult); + } + catch (Exception e) { + LOG.info("Error pre-loading build process for project " + projectPath, e); + } } } }); diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java index 8bf11a9302e2..59c19f0ad7fe 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java @@ -75,19 +75,11 @@ class BuildMessageDispatcher extends SimpleChannelInboundHandlerAdapter