You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2010/05/01 01:29:15 UTC

svn commit: r939875 - /httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachingHttpClient.java

Author: sebb
Date: Fri Apr 30 23:29:15 2010
New Revision: 939875

URL: http://svn.apache.org/viewvc?rev=939875&view=rev
Log:
CachingHttpClient(HttpCache<CacheEntry> cache, int maxObjectSizeBytes) failed to save maxObjectSizeBytes
Make all immutable private fields final

Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachingHttpClient.java

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachingHttpClient.java?rev=939875&r1=939874&r2=939875&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachingHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachingHttpClient.java Fri Apr 30 23:29:15 2010
@@ -60,6 +60,7 @@ import org.apache.http.protocol.HttpCont
  */
 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 implement
 
     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 ConditionalRequestBuilder conditionalRequestBuilder;
-    private int maxObjectSizeBytes = DEFAULT_MAX_OBJECT_SIZE_BYTES;
-    private CacheEntryUpdater cacheEntryUpdater;
+    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 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 implement
         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 implement
             ConditionalRequestBuilder conditionalRequestBuilder, CacheEntryUpdater entryUpdater,
             ResponseProtocolCompliance responseCompliance,
             RequestProtocolCompliance requestCompliance) {
+        this.maxObjectSizeBytes = DEFAULT_MAX_OBJECT_SIZE_BYTES;
         this.backend = backend;
         this.responseCachingPolicy = responseCachingPolicy;
         this.cacheEntryGenerator = cacheEntryGenerator;