Changeset 14898 in josm
- Timestamp:
- 2019-03-18T09:21:40+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r14214 r14898 60 60 public class MultiFetchServerObjectReader extends OsmServerReader { 61 61 /** 62 * the max. number of primitives retrieved in one step. Assuming IDs with 7digits,63 * this leads to a max. request URL of ~ 1 600 Bytes ((7 digits + 1 Separator) * 200),62 * the max. number of primitives retrieved in one step. Assuming IDs with 10 digits, 63 * this leads to a max. request URL of ~ 1900 Bytes ((10 digits + 1 Separator) * 170), 64 64 * which should be safe according to the 65 65 * <a href="http://www.boutell.com/newfaq/misc/urllength.html">WWW FAQ</a>. 66 66 */ 67 private static final int MAX_IDS_PER_REQUEST = 200;67 private static final int MAX_IDS_PER_REQUEST = 170; 68 68 69 69 private final Set<Long> nodes; … … 335 335 try { 336 336 FetchResult result = ecs.take().get(); 337 if (result.rc404 != null) { 338 List<Long> toSplit = new ArrayList<>(result.rc404); 339 int n = toSplit.size() / 2; 340 jobs.add(ecs.submit(new Fetcher(type, new HashSet<>(toSplit.subList(0, n)), progressMonitor))); 341 jobs.add(ecs.submit(new Fetcher(type, new HashSet<>(toSplit.subList(n, toSplit.size())), progressMonitor))); 342 } 337 343 if (result.missingPrimitives != null) { 338 344 missingPrimitives.addAll(result.missingPrimitives); … … 428 434 public final Set<PrimitiveId> missingPrimitives; 429 435 436 private Set<Long> rc404; 437 430 438 /** 431 439 * Constructs a {@code FetchResult} … … 487 495 } catch (OsmApiException e) { 488 496 if (e.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) { 497 if (pkg.size() > 4) { 498 FetchResult res = new FetchResult(null, null); 499 res.rc404 = pkg; 500 return res; 501 } 489 502 Logging.info(tr("Server replied with response code 404, retrying with an individual request for each object.")); 490 503 return singleGetIdPackage(type, pkg, progressMonitor);
Note:
See TracChangeset
for help on using the changeset viewer.