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 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 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 Timer timer
private 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 IOException, org.apache.http.client.ClientProtocolException
doExecute
in class org.apache.http.impl.client.CloseableHttpClient
IOException
org.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.HttpClient
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean isInitialized()
isInitialized
in interface InitializableComponent
public boolean isDestroyed()
isDestroyed
in interface DestructableComponent
public void initialize() throws ComponentInitializationException
initialize
in interface InitializableComponent
ComponentInitializationException
- thrown if there is a problem initializing the componentpublic void destroy()
destroy
in interface DestructableComponent
Copyright © 1999–2018. All rights reserved.