Changeset 16995 in josm


Ignore:
Timestamp:
2020-08-31T20:11:46+02:00 (7 weeks ago)
Author:
simon04
Message:

see #19729, see #19735 - Revert "Main initialization: use ForkJoinPool.commonPool"

This reverts commit r16958

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/spi/lifecycle/Lifecycle.java

    r16958 r16995  
    66import java.util.concurrent.ExecutionException;
    77import java.util.concurrent.ExecutorService;
    8 import java.util.concurrent.ForkJoinPool;
     8import java.util.concurrent.Executors;
    99import java.util.concurrent.Future;
    1010
    1111import org.openstreetmap.josm.tools.JosmRuntimeException;
     12import org.openstreetmap.josm.tools.Logging;
     13import org.openstreetmap.josm.tools.Utils;
    1214import org.openstreetmap.josm.tools.bugreport.BugReport;
    1315
     
    7173        // Initializes tasks to be executed (in parallel) by a ExecutorService
    7274        try {
    73             ExecutorService service = ForkJoinPool.commonPool();
     75            ExecutorService service = Executors.newFixedThreadPool(
     76                    Runtime.getRuntime().availableProcessors(), Utils.newThreadFactory("main-init-%d", Thread.NORM_PRIORITY));
    7477            for (Future<Void> i : service.invokeAll(initSequence.parallelInitializationTasks())) {
    7578                i.get();
     
    7881            initSequence.asynchronousRunnableTasks().forEach(service::submit);
    7982            initSequence.asynchronousCallableTasks().forEach(service::submit);
     83            try {
     84                service.shutdown();
     85            } catch (SecurityException e) {
     86                Logging.log(Logging.LEVEL_ERROR, "Unable to shutdown executor service", e);
     87            }
    8088        } catch (InterruptedException | ExecutionException ex) {
    8189            throw new JosmRuntimeException(ex);
Note: See TracChangeset for help on using the changeset viewer.