public static class FileCachingHttpClientBuilder.StorageManagingHttpClient extends org.apache.http.impl.client.CloseableHttpClient implements InitializableComponent, DestructableComponent
CloseableHttpClient and its associated
ManagedHttpCacheStorage, and manages the scheduled maintenance and lifecycle of the latter.| Modifier and Type | Field and Description |
|---|---|
private boolean |
destroyed
Destroyed flag.
|
private org.apache.http.impl.client.CloseableHttpClient |
httpClient
The wrapped HttpClient instance.
|
private boolean |
initialized
Initialized flag.
|
private org.slf4j.Logger |
log
Logger.
|
private java.util.TimerTask |
maintenanceTask
The scheduled storage maintenance task.
|
private long |
maintenanceTaskInterval
Interval of the scheduled maintenance task.
|
private org.apache.http.impl.client.cache.ManagedHttpCacheStorage |
storage
The cache storage instance to manage.
|
private java.util.Timer |
timer
Scheduled task timer.
|
| Constructor and Description |
|---|
StorageManagingHttpClient(org.apache.http.impl.client.CloseableHttpClient wrappedClient,
org.apache.http.impl.client.cache.ManagedHttpCacheStorage managedStorage,
long taskInterval)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
destroy()
Destroys the component.
|
protected org.apache.http.client.methods.CloseableHttpResponse |
doExecute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.protocol.HttpContext context) |
org.apache.http.conn.ClientConnectionManager |
getConnectionManager()
Deprecated.
|
org.apache.http.params.HttpParams |
getParams()
Deprecated.
|
void |
initialize()
Initializes the component.
|
boolean |
isDestroyed()
Gets whether this component has been destroyed.
|
boolean |
isInitialized()
Gets whether this component is initialized.
|
private org.slf4j.Logger log
private org.apache.http.impl.client.CloseableHttpClient httpClient
private org.apache.http.impl.client.cache.ManagedHttpCacheStorage storage
private long maintenanceTaskInterval
private boolean initialized
private boolean destroyed
private java.util.Timer timer
private java.util.TimerTask maintenanceTask
public StorageManagingHttpClient(@Nonnull
org.apache.http.impl.client.CloseableHttpClient wrappedClient,
@Nonnull
org.apache.http.impl.client.cache.ManagedHttpCacheStorage managedStorage,
long taskInterval)
wrappedClient - the wrapped HttpClient instancemanagedStorage - the managed cache storage instancetaskInterval - the interval at which storage maintenance should runprotected org.apache.http.client.methods.CloseableHttpResponse doExecute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.protocol.HttpContext context)
throws java.io.IOException,
org.apache.http.client.ClientProtocolException
doExecute in class org.apache.http.impl.client.CloseableHttpClientjava.io.IOExceptionorg.apache.http.client.ClientProtocolException@Deprecated public org.apache.http.params.HttpParams getParams()
getParams in interface org.apache.http.client.HttpClient@Deprecated public org.apache.http.conn.ClientConnectionManager getConnectionManager()
getConnectionManager in interface org.apache.http.client.HttpClientpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic boolean isInitialized()
isInitialized in interface InitializableComponentpublic boolean isDestroyed()
isDestroyed in interface DestructableComponentpublic void initialize()
throws ComponentInitializationException
initialize in interface InitializableComponentComponentInitializationException - thrown if there is a problem initializing the componentpublic void destroy()
destroy in interface DestructableComponent