hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r941942 - /httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachingHttpClient.java
Date Thu, 06 May 2010 21:28:45 GMT
Author: sebb
Date: Thu May  6 21:28:45 2010
New Revision: 941942

URL: http://svn.apache.org/viewvc?rev=941942&view=rev
Log:
No need for AtomicLong fields to be volatile
Now @ThreadSafe

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=941942&r1=941941&r2=941942&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
Thu May  6 21:28:45 2010
@@ -42,6 +42,7 @@ import org.apache.http.ProtocolException
 import org.apache.http.ProtocolVersion;
 import org.apache.http.RequestLine;
 import org.apache.http.StatusLine;
+import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.ResponseHandler;
@@ -59,6 +60,7 @@ import org.apache.http.protocol.HttpCont
 /**
  * @since 4.1
  */
+@ThreadSafe // So long as the responseCache implementation is threadsafe
 public class CachingHttpClient implements HttpClient {
 
     private final static int MAX_CACHE_ENTRIES = 1000;
@@ -82,9 +84,9 @@ public class CachingHttpClient implement
     private final int maxObjectSizeBytes;
     private final CacheEntryUpdater cacheEntryUpdater;
 
-    private volatile AtomicLong cacheHits = new AtomicLong();
-    private volatile AtomicLong cacheMisses = new AtomicLong();
-    private volatile AtomicLong cacheUpdates = new AtomicLong();
+    private AtomicLong cacheHits = new AtomicLong();
+    private AtomicLong cacheMisses = new AtomicLong();
+    private AtomicLong cacheUpdates = new AtomicLong();
 
     private final ResponseProtocolCompliance responseCompliance;
     private final RequestProtocolCompliance requestCompliance;



Mime
View raw message