public class RequestScopedHttpClientCache extends HttpClientCache
HttpClientCache
, caching the HttpClient
s for the life time of the request.Constructor and Description |
---|
RequestScopedHttpClientCache() |
Modifier and Type | Method and Description |
---|---|
protected Optional<com.google.common.cache.Cache<CacheKey,org.apache.http.client.HttpClient>> |
getCache()
Getter for the cache to be used.
|
protected CacheKey |
getCacheKey()
Method called in the
#getClient(HttpClientFactory) method to create a CacheKey for no specific
Destination . |
protected CacheKey |
getCacheKey(Destination destination)
Method called in the
#getClient(Destination, HttpClientFactory) method to create a CacheKey for
the given Destination . |
getHttpClient, getHttpClient
@Nonnull protected Optional<com.google.common.cache.Cache<CacheKey,org.apache.http.client.HttpClient>> getCache() throws HttpClientInstantiationException
If the optional is empty a new HttpClient
will be created and not cached.
getCache
in class HttpClientCache
Optional
that may contain the cache to be used by the
HttpClientCache.getHttpClient(Destination, HttpClientFactory)
method.HttpClientInstantiationException
- If there is an issue while accessing the cache.@Nonnull protected CacheKey getCacheKey(@Nonnull Destination destination) throws HttpClientInstantiationException
#getClient(Destination, HttpClientFactory)
method to create a CacheKey
for
the given Destination
.getCacheKey
in class HttpClientCache
destination
- The destination to create a CacheKey
for.CacheKey
for destination.
HttpClientInstantiationException
- If there is an issue while accessing the cache key.@Nonnull protected CacheKey getCacheKey() throws HttpClientInstantiationException
#getClient(HttpClientFactory)
method to create a CacheKey
for no specific
Destination
.getCacheKey
in class HttpClientCache
CacheKey
for a generic http client.HttpClientInstantiationException
- If there is an issue while accessing the cache key.Copyright © 2018 SAP SE. All rights reserved.