Changeset 10087 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-03-30T20:18:14+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r9232 r10087 30 30 import org.openstreetmap.josm.data.cache.ICachedLoaderListener; 31 31 import org.openstreetmap.josm.data.cache.JCSCachedTileLoaderJob; 32 import org.openstreetmap.josm.data.preferences.LongProperty; 32 33 import org.openstreetmap.josm.tools.HttpClient; 33 34 … … 40 41 public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener { 41 42 private static final Logger LOG = FeatureAdapter.getLogger(TMSCachedTileLoaderJob.class.getCanonicalName()); 42 private static final long MAXIMUM_EXPIRES = 30 /*days*/ * 24 /*hours*/ * 60 /*minutes*/ * 60 /*seconds*/ *1000L /*milliseconds*/; 43 private static final long MINIMUM_EXPIRES = 1 /*hour*/ * 60 /*minutes*/ * 60 /*seconds*/ *1000L /*milliseconds*/; 43 private static final LongProperty MAXIMUM_EXPIRES = new LongProperty("imagery.generic.maximum_expires", 44 30 /*days*/ * 24 /*hours*/ * 60 /*minutes*/ * 60 /*seconds*/ *1000L /*milliseconds*/); 45 private static final LongProperty MINIMUM_EXPIRES = new LongProperty("imagery.generic.minimum_expires", 46 1 /*hour*/ * 60 /*minutes*/ * 60 /*seconds*/ *1000L /*milliseconds*/); 44 47 private final Tile tile; 45 48 private volatile URL url; … … 244 247 // keep the expiration time between MINIMUM_EXPIRES and MAXIMUM_EXPIRES, so we will cache the tiles 245 248 // at least for some short period of time, but not too long 246 if (ret.getExpirationTime() < now + MINIMUM_EXPIRES) { 247 ret.setExpirationTime(now + MINIMUM_EXPIRES); 248 } 249 if (ret.getExpirationTime() > now + MAXIMUM_EXPIRES) { 250 ret.setExpirationTime(now + MAXIMUM_EXPIRES); 249 if (ret.getExpirationTime() < now + MINIMUM_EXPIRES.get()) { 250 ret.setExpirationTime(now + MINIMUM_EXPIRES.get()); 251 } 252 if (ret.getExpirationTime() > now + MAXIMUM_EXPIRES.get()) { 253 ret.setExpirationTime(now + MAXIMUM_EXPIRES.get()); 251 254 } 252 255 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.