diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/BasicHttpCache.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/BasicHttpCache.java index 2ab7217bd..b2240e655 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/BasicHttpCache.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/BasicHttpCache.java @@ -30,6 +30,7 @@ import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; +import org.apache.http.annotation.ThreadSafe; import org.apache.http.client.cache.HttpCacheOperationException; import org.apache.http.client.cache.HttpCacheUpdateCallback; import org.apache.http.client.cache.HttpCache; @@ -39,6 +40,7 @@ import org.apache.http.client.cache.HttpCache; * * @since 4.1 */ +@ThreadSafe public class BasicHttpCache implements HttpCache { private final LinkedHashMap baseMap = new LinkedHashMap(20, diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryGenerator.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryGenerator.java index f7de06eaf..00ef83540 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryGenerator.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryGenerator.java @@ -30,10 +30,12 @@ import java.io.IOException; import java.util.Date; import org.apache.http.HttpResponse; +import org.apache.http.annotation.Immutable; /** * @since 4.1 */ +@Immutable public class CacheEntryGenerator { public CacheEntry generateEntry(Date requestDate, Date responseDate, HttpResponse response, diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryUpdater.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryUpdater.java index b592a49ef..8575e375e 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryUpdater.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheEntryUpdater.java @@ -34,12 +34,14 @@ import java.util.ListIterator; import org.apache.http.Header; import org.apache.http.HttpResponse; +import org.apache.http.annotation.Immutable; import org.apache.http.impl.cookie.DateParseException; import org.apache.http.impl.cookie.DateUtils; /** * @since 4.1 */ +@Immutable public class CacheEntryUpdater { public void updateCacheEntry(CacheEntry entry, Date requestDate, Date responseDate, diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheInvalidator.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheInvalidator.java index 28b7b2459..60a4dc968 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheInvalidator.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheInvalidator.java @@ -32,6 +32,7 @@ import org.apache.http.Header; import org.apache.http.HeaderElement; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; +import org.apache.http.annotation.Immutable; import org.apache.http.client.cache.HttpCacheOperationException; import org.apache.http.client.cache.HttpCache; @@ -41,6 +42,7 @@ import org.apache.http.client.cache.HttpCache; * * @since 4.1 */ +@Immutable public class CacheInvalidator { private final HttpCache cache; diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheableRequestPolicy.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheableRequestPolicy.java index 1c46d6178..e3528230d 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheableRequestPolicy.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CacheableRequestPolicy.java @@ -32,12 +32,14 @@ import org.apache.http.Header; import org.apache.http.HeaderElement; import org.apache.http.HttpRequest; import org.apache.http.ProtocolVersion; +import org.apache.http.annotation.Immutable; /** * Determines if an HttpRequest is allowed to be served from the cache. * * @since 4.1 */ +@Immutable public class CacheableRequestPolicy { private static final Log LOG = LogFactory.getLog(CacheableRequestPolicy.class); diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedHttpResponseGenerator.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedHttpResponseGenerator.java index 8167cb962..004848b11 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedHttpResponseGenerator.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedHttpResponseGenerator.java @@ -30,6 +30,7 @@ import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; +import org.apache.http.annotation.Immutable; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicHttpResponse; @@ -39,6 +40,7 @@ import org.apache.http.message.BasicHttpResponse; * * @since 4.1 */ +@Immutable public class CachedHttpResponseGenerator { /** diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedResponseSuitabilityChecker.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedResponseSuitabilityChecker.java index 442e8762a..a7d0d7889 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedResponseSuitabilityChecker.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/CachedResponseSuitabilityChecker.java @@ -32,12 +32,14 @@ import org.apache.http.Header; import org.apache.http.HeaderElement; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; +import org.apache.http.annotation.Immutable; /** * Determines whether a given response can be cached. * * @since 4.1 */ +@Immutable public class CachedResponseSuitabilityChecker { private static final Log LOG = LogFactory.getLog(CachedResponseSuitabilityChecker.class); diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ConditionalRequestBuilder.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ConditionalRequestBuilder.java index 51bfe608e..ee97d4867 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ConditionalRequestBuilder.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ConditionalRequestBuilder.java @@ -29,11 +29,13 @@ package org.apache.http.client.cache.impl; import org.apache.http.Header; import org.apache.http.HttpRequest; import org.apache.http.ProtocolException; +import org.apache.http.annotation.Immutable; import org.apache.http.impl.client.RequestWrapper; /** * @since 4.1 */ +@Immutable public class ConditionalRequestBuilder { public HttpRequest buildConditionalRequest(HttpRequest request, CacheEntry cacheEntry) diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java index cb7f3d455..4942d9a59 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java @@ -32,6 +32,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; +import org.apache.http.annotation.Immutable; import org.apache.http.client.cache.HttpCacheEntrySerializer; /** @@ -42,6 +43,7 @@ import org.apache.http.client.cache.HttpCacheEntrySerializer; * * @since 4.1 */ +@Immutable public class DefaultCacheEntrySerializer implements HttpCacheEntrySerializer { public void writeTo(CacheEntry cacheEntry, OutputStream os) throws IOException { diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/HeaderConstants.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/HeaderConstants.java index 09a6d88ea..6fbf2c92f 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/HeaderConstants.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/HeaderConstants.java @@ -26,9 +26,12 @@ */ package org.apache.http.client.cache.impl; +import org.apache.http.annotation.Immutable; + /** * @since 4.1 */ +@Immutable public class HeaderConstants { public static final String GET_METHOD = "GET"; diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/RequestProtocolCompliance.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/RequestProtocolCompliance.java index aca8d9093..55f0ca151 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/RequestProtocolCompliance.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/RequestProtocolCompliance.java @@ -37,6 +37,7 @@ import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.ProtocolException; import org.apache.http.ProtocolVersion; +import org.apache.http.annotation.Immutable; import org.apache.http.entity.AbstractHttpEntity; import org.apache.http.impl.client.RequestWrapper; import org.apache.http.message.BasicHeader; @@ -46,6 +47,7 @@ import org.apache.http.message.BasicStatusLine; /** * @since 4.1 */ +@Immutable public class RequestProtocolCompliance { public List requestIsFatallyNonCompliant(HttpRequest request) { diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseCachingPolicy.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseCachingPolicy.java index 88cd12307..e4e396943 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseCachingPolicy.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseCachingPolicy.java @@ -33,6 +33,7 @@ import org.apache.http.HeaderElement; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; +import org.apache.http.annotation.Immutable; import org.apache.http.impl.cookie.DateParseException; import org.apache.http.impl.cookie.DateUtils; @@ -41,6 +42,7 @@ import org.apache.http.impl.cookie.DateUtils; * * @since 4.1 */ +@Immutable public class ResponseCachingPolicy { private final int maxObjectSizeBytes; diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseProtocolCompliance.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseProtocolCompliance.java index ee9e31cda..19332aa5e 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseProtocolCompliance.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/ResponseProtocolCompliance.java @@ -33,6 +33,7 @@ import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.ProtocolVersion; +import org.apache.http.annotation.Immutable; import org.apache.http.client.ClientProtocolException; import org.apache.http.impl.client.RequestWrapper; import org.apache.http.impl.cookie.DateUtils; @@ -40,6 +41,7 @@ import org.apache.http.impl.cookie.DateUtils; /** * @since 4.1 */ +@Immutable public class ResponseProtocolCompliance { public void ensureProtocolCompliance(HttpRequest request, HttpResponse response) diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/URIExtractor.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/URIExtractor.java index 20bf7fcb3..90c81f523 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/URIExtractor.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/URIExtractor.java @@ -36,10 +36,12 @@ import org.apache.http.Header; import org.apache.http.HeaderElement; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; +import org.apache.http.annotation.Immutable; /** * @since 4.1 */ +@Immutable public class URIExtractor { public String getURI(HttpHost host, HttpRequest req) {