CachingHttpClient(HttpCache<CacheEntry> cache, int maxObjectSizeBytes) failed to save maxObjectSizeBytes

Make all immutable private fields final

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@939875 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-04-30 23:29:15 +00:00
parent 64c00009a4
commit 16a8c31100
1 changed files with 18 additions and 15 deletions

View File

@ -60,6 +60,7 @@ import org.apache.http.protocol.HttpContext;
*/
public class CachingHttpClient implements HttpClient {
private static final Log LOG = LogFactory.getLog(CachingHttpClient.class);
private final static int MAX_CACHE_ENTRIES = 1000;
private final static int DEFAULT_MAX_OBJECT_SIZE_BYTES = 8192;
@ -67,29 +68,29 @@ public class CachingHttpClient implements HttpClient {
private final static boolean SUPPORTS_RANGE_AND_CONTENT_RANGE_HEADERS = false;
private HttpClient backend;
private ResponseCachingPolicy responseCachingPolicy;
private CacheEntryGenerator cacheEntryGenerator;
private URIExtractor uriExtractor;
private HttpCache<CacheEntry> responseCache;
private CachedHttpResponseGenerator responseGenerator;
private CacheInvalidator cacheInvalidator;
private CacheableRequestPolicy cacheableRequestPolicy;
private CachedResponseSuitabilityChecker suitabilityChecker;
private final HttpClient backend;
private final ResponseCachingPolicy responseCachingPolicy;
private final CacheEntryGenerator cacheEntryGenerator;
private final URIExtractor uriExtractor;
private final HttpCache<CacheEntry> responseCache;
private final CachedHttpResponseGenerator responseGenerator;
private final CacheInvalidator cacheInvalidator;
private final CacheableRequestPolicy cacheableRequestPolicy;
private final CachedResponseSuitabilityChecker suitabilityChecker;
private ConditionalRequestBuilder conditionalRequestBuilder;
private int maxObjectSizeBytes = DEFAULT_MAX_OBJECT_SIZE_BYTES;
private CacheEntryUpdater cacheEntryUpdater;
private final ConditionalRequestBuilder conditionalRequestBuilder;
private final int maxObjectSizeBytes;
private final CacheEntryUpdater cacheEntryUpdater;
private volatile long cacheHits;
private volatile long cacheMisses;
private volatile long cacheUpdates;
private ResponseProtocolCompliance responseCompliance;
private RequestProtocolCompliance requestCompliance;
private static final Log LOG = LogFactory.getLog(CachingHttpClient.class);
private final ResponseProtocolCompliance responseCompliance;
private final RequestProtocolCompliance requestCompliance;
public CachingHttpClient() {
this.backend = new DefaultHttpClient();
this.maxObjectSizeBytes = DEFAULT_MAX_OBJECT_SIZE_BYTES;
this.responseCachingPolicy = new ResponseCachingPolicy(maxObjectSizeBytes);
this.cacheEntryGenerator = new CacheEntryGenerator();
this.uriExtractor = new URIExtractor();
@ -108,6 +109,7 @@ public class CachingHttpClient implements HttpClient {
this.responseCache = cache;
this.backend = new DefaultHttpClient();
this.maxObjectSizeBytes = maxObjectSizeBytes;
this.responseCachingPolicy = new ResponseCachingPolicy(maxObjectSizeBytes);
this.cacheEntryGenerator = new CacheEntryGenerator();
this.uriExtractor = new URIExtractor();
@ -147,6 +149,7 @@ public class CachingHttpClient implements HttpClient {
ConditionalRequestBuilder conditionalRequestBuilder, CacheEntryUpdater entryUpdater,
ResponseProtocolCompliance responseCompliance,
RequestProtocolCompliance requestCompliance) {
this.maxObjectSizeBytes = DEFAULT_MAX_OBJECT_SIZE_BYTES;
this.backend = backend;
this.responseCachingPolicy = responseCachingPolicy;
this.cacheEntryGenerator = cacheEntryGenerator;