allow to fork on two cores (virtualized environments often offer as many)

This commit is contained in:
Alexey Kudravtsev
2013-10-25 13:42:12 +04:00
parent 632df82bbd
commit 71d2675ed7
2 changed files with 3 additions and 2 deletions
@@ -168,7 +168,7 @@ public class JobUtilTest extends PlatformTestCase {
@Override
public boolean process(Object o) {
try {
if (objects.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= 2) {
if (objects.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= JobLauncherImpl.CORES_FORK_THRESHOLD) {
assertTrue(ApplicationManager.getApplication().isDispatchThread());
}
else {
@@ -76,6 +76,7 @@ public class JobLauncherImpl extends JobLauncher {
};
private static final ForkJoinPool pool = new ForkJoinPool(JobSchedulerImpl.CORES_COUNT, FACTORY, null, false);
static final int CORES_FORK_THRESHOLD = 1;
private static <T> boolean invokeConcurrentlyForAll(@NotNull final List<T> things,
boolean runInReadAction,
@@ -121,7 +122,7 @@ public class JobLauncherImpl extends JobLauncher {
// supply our own indicator even if we haven't given one - to support cancellation
final ProgressIndicator wrapper = progress == null ? new ProgressIndicatorBase() : new SensitiveProgressWrapper(progress);
if (things.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= 1) {
if (things.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= CORES_FORK_THRESHOLD) {
final AtomicBoolean result = new AtomicBoolean(true);
ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
@Override