Changeset 9480 in josm for trunk/src


Ignore:
Timestamp:
2016-01-16T03:00:56+01:00 (4 years ago)
Author:
Don-vip
Message:

fix #12376 - Multipolygon test hangs (patch by cmuelle8), regression from r9351

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java

    r9372 r9480  
    376376        @Override
    377377        protected List<PolygonLevel> compute() {
    378             if (to - from < directExecutionTaskSize) {
     378            if (to - from <= directExecutionTaskSize) {
    379379                return computeDirectly();
    380380            } else {
    381381                final Collection<ForkJoinTask<List<PolygonLevel>>> tasks = new ArrayList<>();
    382382                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));
    385                 }
    386                 for (ForkJoinTask<List<PolygonLevel>> task : tasks) {
    387                     output.addAll(task.join());
     383                    tasks.add(new Worker(input, fromIndex, Math.min(fromIndex + directExecutionTaskSize, to), new ArrayList<PolygonLevel>(), directExecutionTaskSize));
     384                }
     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);
    388391                }
    389392                return output;
Note: See TracChangeset for help on using the changeset viewer.