Changeset 31539 in osm


Ignore:
Timestamp:
2015-09-08T15:53:54+02:00 (9 years ago)
Author:
simon04
Message:

jmapviewer: use FutureTask to load bing attribution data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java

    r31538 r31539  
    1212import java.util.concurrent.Callable;
    1313import java.util.concurrent.ExecutionException;
    14 import java.util.concurrent.Executors;
    1514import java.util.concurrent.Future;
    16 import java.util.concurrent.ThreadFactory;
     15import java.util.concurrent.FutureTask;
    1716import java.util.concurrent.TimeUnit;
    1817import java.util.concurrent.TimeoutException;
     
    258257            synchronized (BingAerialTileSource.class) {
    259258                if (attributions == null) {
    260                     attributions = Executors.newSingleThreadExecutor(new ThreadFactory() {
    261                       @Override
    262                       public Thread newThread(Runnable r) {
    263                         return new Thread(r, "bing-attribution-loader");
    264                       }
    265                     }).submit(getAttributionLoaderCallable());
     259                  final FutureTask<List<Attribution>> loader = new FutureTask<>(getAttributionLoaderCallable());
     260                  new Thread(loader, "bing-attribution-loader").start();
     261                  attributions = loader;
    266262                }
    267263            }
Note: See TracChangeset for help on using the changeset viewer.