diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java index 4569e9348..7d831ea2c 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java @@ -80,7 +80,7 @@ class BasicHttpCache implements HttpCache { final ResourceFactory resourceFactory, final HttpCacheStorage storage, final CacheKeyGenerator uriExtractor) { - this(resourceFactory, storage, uriExtractor, new CacheInvalidator(uriExtractor, storage)); + this(resourceFactory, storage, uriExtractor, new DefaultCacheInvalidator(uriExtractor, storage)); } public BasicHttpCache(final ResourceFactory resourceFactory, final HttpCacheStorage storage) { diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java index 989126553..4a9269291 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java @@ -135,7 +135,7 @@ public class CachingHttpAsyncClientBuilder extends HttpAsyncClientBuilder { resourceFactoryCopy, storageCopy, uriExtractor, - this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new CacheInvalidator(uriExtractor, storageCopy)); + this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new DefaultCacheInvalidator(uriExtractor, storageCopy)); final AsyncCachingExec cachingExec = new AsyncCachingExec(httpCache, config); execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name()); diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java index 158361e55..4ae902533 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java @@ -135,7 +135,7 @@ public class CachingHttpClientBuilder extends HttpClientBuilder { resourceFactoryCopy, storageCopy, uriExtractor, - this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new CacheInvalidator(uriExtractor, storageCopy)); + this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new DefaultCacheInvalidator(uriExtractor, storageCopy)); final CachingExec cachingExec = new CachingExec(httpCache, config); execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name()); diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheInvalidator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultCacheInvalidator.java similarity index 98% rename from httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheInvalidator.java rename to httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultCacheInvalidator.java index 3240fff91..553bd425e 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheInvalidator.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultCacheInvalidator.java @@ -54,7 +54,7 @@ import org.apache.logging.log4j.Logger; * @since 4.1 */ @Contract(threading = ThreadingBehavior.IMMUTABLE) -class CacheInvalidator implements HttpCacheInvalidator { +class DefaultCacheInvalidator implements HttpCacheInvalidator { private final HttpCacheStorage storage; private final CacheKeyGenerator cacheKeyGenerator; @@ -62,13 +62,13 @@ class CacheInvalidator implements HttpCacheInvalidator { private final Logger log = LogManager.getLogger(getClass()); /** - * Create a new {@link CacheInvalidator} for a given {@link HttpCache} and + * Create a new {@link DefaultCacheInvalidator} for a given {@link HttpCache} and * {@link CacheKeyGenerator}. * * @param cacheKeyGenerator Provides identifiers for the keys to store cache entries * @param storage the cache to store items away in */ - public CacheInvalidator( + public DefaultCacheInvalidator( final CacheKeyGenerator cacheKeyGenerator, final HttpCacheStorage storage) { this.cacheKeyGenerator = cacheKeyGenerator; diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheInvalidator.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestDefaultCacheInvalidator.java similarity index 98% rename from httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheInvalidator.java rename to httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestDefaultCacheInvalidator.java index 1f555186b..5cd202a22 100644 --- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheInvalidator.java +++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestDefaultCacheInvalidator.java @@ -46,16 +46,15 @@ import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpHost; import org.apache.hc.core5.http.HttpStatus; -import org.apache.hc.core5.http.ProtocolVersion; import org.apache.hc.core5.http.message.BasicClassicHttpRequest; import org.apache.hc.core5.http.message.BasicClassicHttpResponse; import org.apache.hc.core5.http.message.BasicHeader; import org.junit.Before; import org.junit.Test; -public class TestCacheInvalidator { +public class TestDefaultCacheInvalidator { - private CacheInvalidator impl; + private DefaultCacheInvalidator impl; private HttpCacheStorage mockStorage; private HttpHost host; private CacheKeyGenerator cacheKeyGenerator; @@ -78,7 +77,7 @@ public class TestCacheInvalidator { request = HttpTestUtils.makeDefaultRequest(); response = HttpTestUtils.make200Response(); - impl = new CacheInvalidator(cacheKeyGenerator, mockStorage); + impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage); } // Tests @@ -205,7 +204,7 @@ public class TestCacheInvalidator { @Test public void testInvalidatesHEADCacheEntryIfSubsequentGETRequestsAreMadeToTheSameURI() throws Exception { - impl = new CacheInvalidator(cacheKeyGenerator, mockStorage); + impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage); final String theURI = "http://foo.example.com:80/"; request = new BasicClassicHttpRequest("GET", theURI); @@ -223,7 +222,7 @@ public class TestCacheInvalidator { @Test public void testInvalidatesVariantHEADCacheEntriesIfSubsequentGETRequestsAreMadeToTheSameURI() throws Exception { - impl = new CacheInvalidator(cacheKeyGenerator, mockStorage); + impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage); final String theURI = "http://foo.example.com:80/"; request = new BasicClassicHttpRequest("GET", theURI); final String theVariantKey = "{Accept-Encoding=gzip%2Cdeflate&User-Agent=Apache-HttpClient}"; @@ -258,7 +257,7 @@ public class TestCacheInvalidator { @Test public void testDoesNotInvalidateHEADCacheEntryIfSubsequentHEADRequestsAreMadeToTheSameURI() throws Exception { - impl = new CacheInvalidator(cacheKeyGenerator, mockStorage); + impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage); final String theURI = "http://foo.example.com:80/"; request = new BasicClassicHttpRequest("HEAD", theURI); @@ -272,7 +271,7 @@ public class TestCacheInvalidator { @Test public void testDoesNotInvalidateGETCacheEntryIfSubsequentGETRequestsAreMadeToTheSameURI() throws Exception { - impl = new CacheInvalidator(cacheKeyGenerator, mockStorage); + impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage); final String theURI = "http://foo.example.com:80/"; request = new BasicClassicHttpRequest("GET", theURI);