public abstract class HttpClientCache extends Object
HttpClientAccessor
.Constructor and Description |
---|
HttpClientCache() |
Modifier and Type | Method and Description |
---|---|
protected abstract Optional<com.google.common.cache.Cache<CacheKey,org.apache.http.client.HttpClient>> |
getCache()
Getter for the cache to be used.
|
protected abstract CacheKey |
getCacheKey()
Method called in the
#getClient(HttpClientFactory) method to create a CacheKey for no specific
Destination . |
protected abstract CacheKey |
getCacheKey(Destination destination)
Method called in the
#getClient(Destination, HttpClientFactory) method to create a CacheKey for
the given Destination . |
protected org.apache.http.client.HttpClient |
getHttpClient(Destination destination,
HttpClientFactory httpClientProvider)
Gets the
HttpClient for the given Destination from this cache. |
protected org.apache.http.client.HttpClient |
getHttpClient(HttpClientFactory httpClientProvider)
Gets the non-destination-specific
HttpClient from this cache. |
@Nonnull protected org.apache.http.client.HttpClient getHttpClient(@Nonnull Destination destination, @Nonnull HttpClientFactory httpClientProvider) throws HttpClientInstantiationException
HttpClient
for the given Destination
from this cache.
If there is no HttpClient
for destination
it is created by using the HttpClientFactory
.
destination
- The Destination
to get the HttpClient
for.httpClientProvider
- The HttpClientFactory
used to create a new HttpClient
if no cached one can be found.HttpClient
for the given Destination
.HttpClientInstantiationException
- If there is an issue while retrieving the HttpClient
.@Nonnull protected org.apache.http.client.HttpClient getHttpClient(@Nonnull HttpClientFactory httpClientProvider) throws HttpClientInstantiationException
HttpClient
from this cache.
If there is no generic HttpClient
it is created by using the HttpClientFactory
.
httpClientProvider
- The HttpClientFactory
used to create a new HttpClient
if no cached one can be found.HttpClient
.HttpClientInstantiationException
- If there is an issue while retrieving the HttpClient
.@Nonnull protected abstract 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.
Optional
that may contain the cache to be used by the
getHttpClient(Destination, HttpClientFactory)
method.HttpClientInstantiationException
- If there is an issue while accessing the cache.@Nonnull protected abstract CacheKey getCacheKey(@Nonnull Destination destination) throws HttpClientInstantiationException
#getClient(Destination, HttpClientFactory)
method to create a CacheKey
for
the given Destination
.destination
- The destination to create a CacheKey
for.CacheKey
for destination.
HttpClientInstantiationException
- If there is an issue while accessing the cache key.@Nonnull protected abstract CacheKey getCacheKey() throws HttpClientInstantiationException
#getClient(HttpClientFactory)
method to create a CacheKey
for no specific
Destination
.CacheKey
for a generic http client.HttpClientInstantiationException
- If there is an issue while accessing the cache key.Copyright © 2018 SAP SE. All rights reserved.