startup is called also from AppStarter — no need to configure fork join pool again

GitOrigin-RevId: 8fbf187a4ff792ec2fef0e2e05b137a52e30915f
This commit is contained in:
Vladimir Krivosheev
2020-01-10 16:56:49 +01:00
committed by intellij-monorepo-bot
parent cea404e4ed
commit 60104cabcb
3 changed files with 24 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection;
import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory;
import com.intellij.execution.configurations.ParametersList;
import com.intellij.openapi.application.ApplicationStarter;
import com.intellij.util.ArrayUtilRt;
@@ -8,10 +9,8 @@ import com.sampullara.cli.Args;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.concurrent.ForkJoinPool;
/**
* @author Roman.Chernyatchik
*/
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public abstract class AbstractInspectionToolStarter implements ApplicationStarter {
protected InspectionApplication myApplication;
@@ -70,11 +69,15 @@ public abstract class AbstractInspectionToolStarter implements ApplicationStarte
@Override
public void main(@NotNull String[] args) {
myOptions.beforeStartup();
IdeaForkJoinWorkerThreadFactory.setupForkJoinCommonPool(true);
InspectionApplication.LOG.info("CPU cores: " + Runtime.getRuntime().availableProcessors() + "; ForkJoinPool.commonPool: " + ForkJoinPool.commonPool() + "; factory: " + ForkJoinPool.commonPool().getFactory());
myApplication.startup();
}
private static void initApplication(@NotNull final InspectionApplication application,
@NotNull final InspectionToolCmdlineOptions opts) {
private static void initApplication(@NotNull InspectionApplication application,
@NotNull InspectionToolCmdlineOptions opts) {
opts.initApplication(application);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection;
import com.google.common.collect.Lists;
@@ -6,7 +6,6 @@ import com.intellij.analysis.AnalysisScope;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInspection.ex.*;
import com.intellij.codeInspection.reference.RefElement;
import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory;
import com.intellij.conversion.ConversionListener;
import com.intellij.conversion.ConversionService;
import com.intellij.diff.tools.util.text.LineOffsetsUtil;
@@ -70,16 +69,12 @@ import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.LockSupport;
/**
* @author max
*/
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public class InspectionApplication implements CommandLineInspectionProgressReporter {
private static final Logger LOG = Logger.getInstance(InspectionApplication.class);
public final class InspectionApplication implements CommandLineInspectionProgressReporter {
static final Logger LOG = Logger.getInstance(InspectionApplication.class);
public InspectionToolCmdlineOptionHelpProvider myHelpProvider;
public String myProjectPath;
@@ -115,8 +110,7 @@ public class InspectionApplication implements CommandLineInspectionProgressRepor
reportError("Profile to inspect with is not defined");
printHelp();
}
IdeaForkJoinWorkerThreadFactory.setupForkJoinCommonPool(true);
LOG.info("CPU cores: " + Runtime.getRuntime().availableProcessors() + "; ForkJoinPool.commonPool: " + ForkJoinPool.commonPool() + "; factory: " + ForkJoinPool.commonPool().getFactory());
ApplicationManagerEx.getApplicationEx().setSaveAllowed(false);
try {
execute();

View File

@@ -233,20 +233,11 @@ private fun startApp(app: ApplicationImpl,
// not good, so force execution out of EDT
nonEdtExecutor
)
.thenRunAsync(
Runnable {
(TransactionGuard.getInstance() as TransactionGuardImpl).performUserActivity {
starter.main(ArrayUtilRt.toStringArray(args))
}
if (PluginManagerCore.isRunningFromSources()) {
NonUrgentExecutor.getInstance().execute {
AppUIUtil.updateWindowIcon(JOptionPane.getRootFrame())
}
}
},
edtExecutor
)
.thenRunAsync(Runnable {
(TransactionGuard.getInstance() as TransactionGuardImpl).performUserActivity {
starter.main(ArrayUtilRt.toStringArray(args))
}
}, edtExecutor)
.exceptionally {
StartupAbortedException.processException(it)
null
@@ -496,6 +487,12 @@ open class IdeStarter : ApplicationStarter {
}
StartUpMeasurer.compareAndSetCurrentState(LoadingState.COMPONENTS_LOADED, LoadingState.APP_STARTED)
if (PluginManagerCore.isRunningFromSources()) {
NonUrgentExecutor.getInstance().execute {
AppUIUtil.updateWindowIcon(JOptionPane.getRootFrame())
}
}
}
private fun showWizardAndWelcomeFrame(lifecyclePublisher: AppLifecycleListener, willOpenProject: Boolean): Boolean {