Changeset 16995 in josm
- Timestamp:
- 2020-08-31T20:11:46+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/spi/lifecycle/Lifecycle.java
r16958 r16995 6 6 import java.util.concurrent.ExecutionException; 7 7 import java.util.concurrent.ExecutorService; 8 import java.util.concurrent. ForkJoinPool;8 import java.util.concurrent.Executors; 9 9 import java.util.concurrent.Future; 10 10 11 11 import org.openstreetmap.josm.tools.JosmRuntimeException; 12 import org.openstreetmap.josm.tools.Logging; 13 import org.openstreetmap.josm.tools.Utils; 12 14 import org.openstreetmap.josm.tools.bugreport.BugReport; 13 15 … … 71 73 // Initializes tasks to be executed (in parallel) by a ExecutorService 72 74 try { 73 ExecutorService service = ForkJoinPool.commonPool(); 75 ExecutorService service = Executors.newFixedThreadPool( 76 Runtime.getRuntime().availableProcessors(), Utils.newThreadFactory("main-init-%d", Thread.NORM_PRIORITY)); 74 77 for (Future<Void> i : service.invokeAll(initSequence.parallelInitializationTasks())) { 75 78 i.get(); … … 78 81 initSequence.asynchronousRunnableTasks().forEach(service::submit); 79 82 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 } 80 88 } catch (InterruptedException | ExecutionException ex) { 81 89 throw new JosmRuntimeException(ex);
Note:
See TracChangeset
for help on using the changeset viewer.