public class HttpClientStore
extends java.lang.Object
setHttpClientTypeCurrentDefault(HttpClientType)
to change the default one
(default one is the embedded fast)Modifier and Type | Field and Description |
---|---|
private AsyncHttpClientFactoryEmbed |
httpClientFactoryEmbed
The http client factory embed.
|
private HttpClientType |
httpClientTypeCurrentDefault
The http client type current default.
|
private static HttpClientStore |
instance
The singleton instance.
|
private java.util.Map<HttpClientType,com.ning.http.client.AsyncHttpClient> |
map
The Constant map.
|
Modifier | Constructor and Description |
---|---|
private |
HttpClientStore()
Instantiates a new http client store.
|
Modifier and Type | Method and Description |
---|---|
com.ning.http.client.AsyncHttpClient |
getClientByType(HttpClientType type)
Gets the client by type.
|
com.ning.http.client.AsyncHttpClient |
getCurrentDefaultClient()
Gets the current default client.
|
com.ning.http.client.AsyncHttpClient |
getCustomClientFast()
Gets the custom client fast.
|
com.ning.http.client.AsyncHttpClient |
getCustomClientSlow()
Gets the custom client slow.
|
com.ning.http.client.AsyncHttpClient |
getEmbedClientFast()
default fast is the default.
|
com.ning.http.client.AsyncHttpClient |
getEmbedClientSlow()
Gets the embed client slow.
|
AsyncHttpClientFactoryEmbed |
getHttpClientFactoryEmbed()
Gets the http client factory embed.
|
HttpClientType |
getHttpClientTypeCurrentDefault()
Gets the http client type current default.
|
static HttpClientStore |
getInstance() |
java.util.Map<HttpClientType,com.ning.http.client.AsyncHttpClient> |
getMap()
Gets the map.
|
void |
init()
Initialize
|
void |
reinit()
close and clean up the http client, then create the new ones.
|
void |
setCustomClientFast(com.ning.http.client.AsyncHttpClient client)
Sets the custom client fast.
|
void |
setCustomClientSlow(com.ning.http.client.AsyncHttpClient client)
Sets the custom client slow.
|
void |
setHttpClientFactoryEmbed(AsyncHttpClientFactoryEmbed httpClientFactoryEmbed)
Sets the http client factory embed.
|
void |
setHttpClientTypeCurrentDefault(HttpClientType httpClientTypeCurrentDefault)
this is a key function, and all new command builder will use this one .
|
void |
shutdown()
Shutdown each AHC client in the map.
|
private HttpClientType httpClientTypeCurrentDefault
private final java.util.Map<HttpClientType,com.ning.http.client.AsyncHttpClient> map
private AsyncHttpClientFactoryEmbed httpClientFactoryEmbed
private static final HttpClientStore instance
public static HttpClientStore getInstance()
public void init()
public void reinit()
public void shutdown()
public com.ning.http.client.AsyncHttpClient getEmbedClientFast()
public com.ning.http.client.AsyncHttpClient getEmbedClientSlow()
public com.ning.http.client.AsyncHttpClient getCustomClientFast()
public com.ning.http.client.AsyncHttpClient getCustomClientSlow()
public com.ning.http.client.AsyncHttpClient getClientByType(HttpClientType type)
type
- the typepublic com.ning.http.client.AsyncHttpClient getCurrentDefaultClient()
public void setCustomClientFast(com.ning.http.client.AsyncHttpClient client)
client
- the new custom client fastpublic void setCustomClientSlow(com.ning.http.client.AsyncHttpClient client)
client
- the new custom client slowpublic HttpClientType getHttpClientTypeCurrentDefault()
public void setHttpClientTypeCurrentDefault(HttpClientType httpClientTypeCurrentDefault)
httpClientTypeCurrentDefault
- the new http client type current defaultpublic java.util.Map<HttpClientType,com.ning.http.client.AsyncHttpClient> getMap()
public AsyncHttpClientFactoryEmbed getHttpClientFactoryEmbed()
public void setHttpClientFactoryEmbed(AsyncHttpClientFactoryEmbed httpClientFactoryEmbed)
httpClientFactoryEmbed
- the new http client factory embed