Changeset 32976 in osm for applications/editors/josm
- Timestamp:
- 2016-09-11T13:47:45+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r32690 r32976 81 81 82 82 /** All the Threads that have been run. Used to interrupt them properly. */ 83 private static List<Thread> threads = new ArrayList<>();83 //private static List<Thread> threads = new ArrayList<>(); 84 84 85 85 /** Max area to be downloaded */ … … 130 130 } 131 131 132 private static void run( Threadt) {133 threads.add(t);132 private static void run(Runnable t) { 133 //threads.add(t); 134 134 executor.execute(t); 135 135 } … … 245 245 */ 246 246 public static void stopAll() { 247 for (Thread t : threads) {247 /*for (Thread t : threads) { 248 248 if (t.isAlive()) 249 249 Main.info(t+" is still alive!"); 250 250 t.interrupt(); 251 251 } 252 threads.clear(); 252 threads.clear();*/ 253 253 executor.shutdownNow(); 254 254 try { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java
r31974 r32976 26 26 * @see MapillaryTrafficSignDownloadThread 27 27 */ 28 public class MapillarySquareDownloadManagerThread extends Thread{28 public class MapillarySquareDownloadManagerThread implements Runnable { 29 29 30 30 private final Bounds bounds; 31 31 32 private final ThreadPoolExecutor downloadExecutor = new ThreadPoolExecutor(3, 5, 33 25, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(5)); 34 private final ThreadPoolExecutor completeExecutor = new ThreadPoolExecutor(3, 5, 35 25, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(5)); 36 private final ThreadPoolExecutor signsExecutor = new ThreadPoolExecutor(3, 5, 25, 37 TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(5)); 32 private ThreadPoolExecutor downloadExecutor; 33 private ThreadPoolExecutor completeExecutor; 34 private ThreadPoolExecutor signsExecutor; 38 35 39 36 /** … … 49 46 @Override 50 47 public void run() { 48 downloadExecutor = new ThreadPoolExecutor(3, 5, 49 25, TimeUnit.SECONDS, new ArrayBlockingQueue<>(5)); 50 completeExecutor = new ThreadPoolExecutor(3, 5, 51 25, TimeUnit.SECONDS, new ArrayBlockingQueue<>(5)); 52 signsExecutor = new ThreadPoolExecutor(3, 5, 25, 53 TimeUnit.SECONDS, new ArrayBlockingQueue<>(5)); 54 51 55 try { 52 56 PluginState.startDownload(); … … 77 81 this.downloadExecutor.execute(new MapillarySequenceDownloadThread(this.downloadExecutor, bounds, page)); 78 82 while (this.downloadExecutor.getQueue().remainingCapacity() == 0) { 79 Thread.sleep( 500);83 Thread.sleep(100); 80 84 } 81 85 page++; … … 120 124 this.signsExecutor.awaitTermination(15, TimeUnit.SECONDS); 121 125 } 122 123 @Override124 public void interrupt() {125 super.interrupt();126 this.downloadExecutor.shutdownNow();127 this.completeExecutor.shutdownNow();128 this.signsExecutor.shutdownNow();129 try {130 this.downloadExecutor.awaitTermination(15, TimeUnit.SECONDS);131 this.completeExecutor.awaitTermination(15, TimeUnit.SECONDS);132 this.signsExecutor.awaitTermination(15, TimeUnit.SECONDS);133 } catch (InterruptedException e) {134 Main.error(e);135 }136 }137 126 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/ImageUtil.java
r32975 r32976 46 46 throw new IOException(f.getAbsolutePath() + " not found or not readable!"); 47 47 } else if (f.isDirectory()) { 48 for (File child : f.listFiles()) { 48 File[] files = f.listFiles(); 49 assert files != null; 50 for (File child : files) { 49 51 try { 50 52 images.addAll(readImagesFrom(child, defaultLL));
Note:
See TracChangeset
for help on using the changeset viewer.