Changeset 16958 in josm


Ignore:
Timestamp:
2020-08-29T09:28:23+02:00 (4 years ago)
Author:
simon04
Message:

fix #19729 - Main initialization: use ForkJoinPool.commonPool

File:
1 edited

Legend:

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

    r14140 r16958  
    66import java.util.concurrent.ExecutionException;
    77import java.util.concurrent.ExecutorService;
    8 import java.util.concurrent.Executors;
     8import java.util.concurrent.ForkJoinPool;
    99import java.util.concurrent.Future;
    1010
    1111import org.openstreetmap.josm.tools.JosmRuntimeException;
    12 import org.openstreetmap.josm.tools.Logging;
    13 import org.openstreetmap.josm.tools.Utils;
    1412import org.openstreetmap.josm.tools.bugreport.BugReport;
    1513
     
    7371        // Initializes tasks to be executed (in parallel) by a ExecutorService
    7472        try {
    75             ExecutorService service = Executors.newFixedThreadPool(
    76                     Runtime.getRuntime().availableProcessors(), Utils.newThreadFactory("main-init-%d", Thread.NORM_PRIORITY));
     73            ExecutorService service = ForkJoinPool.commonPool();
    7774            for (Future<Void> i : service.invokeAll(initSequence.parallelInitializationTasks())) {
    7875                i.get();
     
    8178            initSequence.asynchronousRunnableTasks().forEach(service::submit);
    8279            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             }
    8880        } catch (InterruptedException | ExecutionException ex) {
    8981            throw new JosmRuntimeException(ex);
Note: See TracChangeset for help on using the changeset viewer.