Changeset 9324 in josm


Ignore:
Timestamp:
2016-01-05T23:27:01+01:00 (4 years ago)
Author:
simon04
Message:

MultiFetchServerObjectReader: shutdown threads after use

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r9242 r9324  
    1919import java.util.concurrent.CompletionService;
    2020import java.util.concurrent.ExecutionException;
    21 import java.util.concurrent.Executor;
    2221import java.util.concurrent.ExecutorCompletionService;
     22import java.util.concurrent.ExecutorService;
    2323import java.util.concurrent.Executors;
    2424import java.util.concurrent.Future;
     
    325325        int threadsNumber = Main.pref.getInteger("osm.download.threads", OsmApi.MAX_DOWNLOAD_THREADS);
    326326        threadsNumber = Math.min(Math.max(threadsNumber, 1), OsmApi.MAX_DOWNLOAD_THREADS);
    327         Executor exec = Executors.newFixedThreadPool(threadsNumber, Utils.newThreadFactory(getClass() + "-%d", Thread.NORM_PRIORITY));
     327        final ExecutorService exec = Executors.newFixedThreadPool(
     328                threadsNumber, Utils.newThreadFactory(getClass() + "-%d", Thread.NORM_PRIORITY));
    328329        CompletionService<FetchResult> ecs = new ExecutorCompletionService<>(exec);
    329330        List<Future<FetchResult>> jobs = new ArrayList<>();
     
    347348            }
    348349        }
    349         // Cancel requests if the user choosed to
     350        exec.shutdown();
     351        // Cancel requests if the user chose to
    350352        if (isCanceled()) {
    351353            for (Future<FetchResult> job : jobs) {
Note: See TracChangeset for help on using the changeset viewer.