Changeset 31841 in osm for applications/editors/josm/plugins/mapillary/src/org
- Timestamp:
- 2015-12-16T17:17:13+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31840 r31841 56 56 public class UploadUtils { 57 57 58 /** Required keys for POST */ 59 private static final String[] keys = { "key", "AWSAccessKeyId", "acl", 60 "policy", "signature", "Content-Type" }; 61 62 /** Mapillary upload URL */ 63 private static final String UPLOAD_URL = "https://s3-eu-west-1.amazonaws.com/mapillary.uploads.manual.images"; 64 65 /** Count to name temporal files. */ 66 private static int c; 67 58 68 private static class SequenceUploadThread extends Thread { 59 69 private final List<MapillaryAbstractImage> images; 60 70 private final UUID uuid; 61 71 private final boolean delete; 62 private ThreadPoolExecutor ex; 72 private final ThreadPoolExecutor ex; 63 73 64 74 private SequenceUploadThread(List<MapillaryAbstractImage> images, … … 66 76 this.images = images; 67 77 this.uuid = UUID.randomUUID(); 68 this.ex = new ThreadPoolExecutor(8, 8, 25, TimeUnit.SECONDS, 69 new ArrayBlockingQueue<Runnable>(15)); 78 this.ex = new ThreadPoolExecutor(8, 8, 25, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(15)); 70 79 this.delete = delete; 71 80 } … … 77 86 for (MapillaryAbstractImage img : this.images) { 78 87 if (!(img instanceof MapillaryImportedImage)) 79 throw new IllegalArgumentException( 80 "The sequence contains downloaded images."); 81 this.ex.execute(new SingleUploadThread((MapillaryImportedImage) img, 82 this.uuid)); 83 while (this.ex.getQueue().remainingCapacity() == 0) 88 throw new IllegalArgumentException("The sequence contains downloaded images."); 89 this.ex.execute(new SingleUploadThread((MapillaryImportedImage) img, this.uuid)); 90 while (this.ex.getQueue().remainingCapacity() == 0) { 84 91 try { 85 92 Thread.sleep(100); … … 87 94 Main.error(e); 88 95 } 96 } 89 97 } 90 98 this.ex.shutdown(); … … 114 122 } 115 123 } 116 /** Required keys for POST */117 private static final String[] keys = { "key", "AWSAccessKeyId", "acl",118 "policy", "signature", "Content-Type" };119 120 /** Mapillary upload URL */121 private static final String UPLOAD_URL = "https://s3-eu-west-1.amazonaws.com/mapillary.uploads.manual.images";122 123 /** Count to name temporal files. */124 private static int c = 0;125 124 126 125 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/PluginState.java
r31838 r31841 15 15 * 16 16 */ 17 public class PluginState { 17 public final class PluginState { 18 18 19 19 private static int runningDownloads;
Note:
See TracChangeset
for help on using the changeset viewer.