Ticket #12376: josm-12376-MultipolygonBuilder-invokeAll-tasks.patch
File josm-12376-MultipolygonBuilder-invokeAll-tasks.patch, 1.6 KB (added by , 9 years ago) |
---|
-
src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java
375 375 376 376 @Override 377 377 protected List<PolygonLevel> compute() { 378 if (to - from < directExecutionTaskSize) {378 if (to - from <= directExecutionTaskSize) { 379 379 return computeDirectly(); 380 380 } else { 381 381 final Collection<ForkJoinTask<List<PolygonLevel>>> tasks = new ArrayList<>(); 382 382 for (int fromIndex = from; fromIndex < to; fromIndex += directExecutionTaskSize) { 383 final List<PolygonLevel> output = new ArrayList<>(); 384 tasks.add(new Worker(input, fromIndex, Math.min(fromIndex + directExecutionTaskSize, to), output, directExecutionTaskSize)); 383 tasks.add(new Worker(input, fromIndex, Math.min(fromIndex + directExecutionTaskSize, to), new ArrayList<PolygonLevel>(), directExecutionTaskSize)); 385 384 } 386 for (ForkJoinTask<List<PolygonLevel>> task : tasks) { 387 output.addAll(task.join()); 385 for (ForkJoinTask<List<PolygonLevel>> task : ForkJoinTask.invokeAll(tasks)) { 386 List<PolygonLevel> res = task.join(); 387 if (res == null) { 388 return null; 389 } 390 output.addAll(res); 388 391 } 389 392 return output; 390 393 }