public abstract class AbstractHttpClientCache extends Object implements HttpClientCache
HttpClientAccessor
.Constructor and Description |
---|
AbstractHttpClientCache() |
Modifier and Type | Method and Description |
---|---|
protected abstract io.vavr.control.Try<com.github.benmanes.caffeine.cache.Cache<CacheKey,org.apache.http.client.HttpClient>> |
getCache()
Getter for the cache to be used.
|
protected abstract io.vavr.control.Try<CacheKey> |
getCacheKey()
Method called in the
#getClient(HttpClientFactory) method to create a CacheKey for no specific
Destination . |
protected abstract io.vavr.control.Try<CacheKey> |
getCacheKey(HttpDestinationProperties destination)
Method called in the
#getClient(Destination, HttpClientFactory) method to create a CacheKey for
the given Destination . |
io.vavr.control.Try<org.apache.http.client.HttpClient> |
tryGetHttpClient(HttpClientFactory httpClientFactory)
Gets the non-destination-specific
HttpClient from this cache. |
io.vavr.control.Try<org.apache.http.client.HttpClient> |
tryGetHttpClient(HttpDestinationProperties destination,
HttpClientFactory httpClientFactory)
Gets the
HttpClient for the given Destination from this cache. |
@Nonnull public io.vavr.control.Try<org.apache.http.client.HttpClient> tryGetHttpClient(@Nonnull HttpDestinationProperties destination, @Nonnull HttpClientFactory httpClientFactory)
HttpClient
for the given Destination
from this cache.
If there is no HttpClient
for destination
it is created by using the HttpClientFactory
.
tryGetHttpClient
in interface HttpClientCache
destination
- The Destination
to get the HttpClient
for.httpClientFactory
- The HttpClientFactory
used to create a new HttpClient
if no cached one can be found.Try
of the cached HttpClient
for the given Destination
.@Nonnull public io.vavr.control.Try<org.apache.http.client.HttpClient> tryGetHttpClient(@Nonnull HttpClientFactory httpClientFactory)
HttpClient
from this cache.
If there is no generic HttpClient
it is created by using the HttpClientFactory
.
tryGetHttpClient
in interface HttpClientCache
httpClientFactory
- The HttpClientFactory
used to create a new HttpClient
if no cached one can be found.Try
of the cached HttpClient
.@Nonnull protected abstract io.vavr.control.Try<com.github.benmanes.caffeine.cache.Cache<CacheKey,org.apache.http.client.HttpClient>> getCache()
If the optional is empty a new HttpClient
will be created and not cached.
Try
of the cache to be used by the
tryGetHttpClient(HttpDestinationProperties, HttpClientFactory)
method.HttpClientInstantiationException
- If there is an issue while accessing the cache.@Nonnull protected abstract io.vavr.control.Try<CacheKey> getCacheKey(@Nonnull HttpDestinationProperties destination)
#getClient(Destination, HttpClientFactory)
method to create a CacheKey
for
the given Destination
.destination
- The destination to create a CacheKey
for.Try
of the CacheKey
for destination.
HttpClientInstantiationException
- If there is an issue while accessing the cache key.@Nonnull protected abstract io.vavr.control.Try<CacheKey> getCacheKey()
#getClient(HttpClientFactory)
method to create a CacheKey
for no specific
Destination
.Try
of the CacheKey
for a generic HttpClient
.HttpClientInstantiationException
- If there is an issue while accessing the cache key.Copyright © 2020 SAP SE. All rights reserved.