Class FileCachingHttpClientBuilder.StorageManagingHttpClient
java.lang.Object
org.apache.http.impl.client.CloseableHttpClient
net.shibboleth.utilities.java.support.httpclient.FileCachingHttpClientBuilder.StorageManagingHttpClient
- All Implemented Interfaces:
Closeable,AutoCloseable,Component,DestructableComponent,InitializableComponent,org.apache.http.client.HttpClient
- Enclosing class:
- FileCachingHttpClientBuilder
private static class FileCachingHttpClientBuilder.StorageManagingHttpClient
extends org.apache.http.impl.client.CloseableHttpClient
implements InitializableComponent, DestructableComponent
Class which wraps a caching instance of
CloseableHttpClient and its associated
ManagedHttpCacheStorage, and manages the scheduled maintenance and lifecycle of the latter.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanDestroyed flag.private org.apache.http.impl.client.CloseableHttpClientThe wrapped HttpClient instance.private booleanInitialized flag.private org.slf4j.LoggerLogger.private TimerTaskThe scheduled storage maintenance task.private longInterval of the scheduled maintenance task.private org.apache.http.impl.client.cache.ManagedHttpCacheStorageThe cache storage instance to manage.private TimerScheduled task timer. -
Constructor Summary
ConstructorsConstructorDescriptionStorageManagingHttpClient(org.apache.http.impl.client.CloseableHttpClient wrappedClient, org.apache.http.impl.client.cache.ManagedHttpCacheStorage managedStorage, long taskInterval) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddestroy()Destroys the component.protected org.apache.http.client.methods.CloseableHttpResponsedoExecute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) org.apache.http.conn.ClientConnectionManagerDeprecated.org.apache.http.params.HttpParamsDeprecated.voidInitializes the component.booleanGets whether this component has been destroyed.booleanGets whether this component is initialized.Methods inherited from class org.apache.http.impl.client.CloseableHttpClient
execute, execute, execute, execute, execute, execute, execute, execute
-
Field Details
-
log
private org.slf4j.Logger logLogger. -
httpClient
private org.apache.http.impl.client.CloseableHttpClient httpClientThe wrapped HttpClient instance. -
storage
private org.apache.http.impl.client.cache.ManagedHttpCacheStorage storageThe cache storage instance to manage. -
maintenanceTaskInterval
private long maintenanceTaskIntervalInterval of the scheduled maintenance task. -
initialized
private boolean initializedInitialized flag. -
destroyed
private boolean destroyedDestroyed flag. -
timer
Scheduled task timer. -
maintenanceTask
The scheduled storage maintenance task.
-
-
Constructor Details
-
StorageManagingHttpClient
public StorageManagingHttpClient(@Nonnull org.apache.http.impl.client.CloseableHttpClient wrappedClient, @Nonnull org.apache.http.impl.client.cache.ManagedHttpCacheStorage managedStorage, long taskInterval) Constructor.- Parameters:
wrappedClient- the wrapped HttpClient instancemanagedStorage- the managed cache storage instancetaskInterval- the interval at which storage maintenance should run
-
-
Method Details
-
doExecute
protected org.apache.http.client.methods.CloseableHttpResponse doExecute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) throws IOException, org.apache.http.client.ClientProtocolException - Specified by:
doExecutein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
IOExceptionorg.apache.http.client.ClientProtocolException
-
getParams
Deprecated.- Specified by:
getParamsin interfaceorg.apache.http.client.HttpClient
-
getConnectionManager
Deprecated.- Specified by:
getConnectionManagerin interfaceorg.apache.http.client.HttpClient
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isInitialized
public boolean isInitialized()Gets whether this component is initialized.- Specified by:
isInitializedin interfaceInitializableComponent- Returns:
- true iff this component is initialized
-
isDestroyed
public boolean isDestroyed()Gets whether this component has been destroyed. Normally, once a component has been destroyed it cannot be used.- Specified by:
isDestroyedin interfaceDestructableComponent- Returns:
- true iff the component has been destroyed
-
initialize
Initializes the component.- Specified by:
initializein interfaceInitializableComponent- Throws:
ComponentInitializationException- thrown if there is a problem initializing the component
-
destroy
public void destroy()Destroys the component.- Specified by:
destroyin interfaceDestructableComponent
-