public interface AsyncHttpClientRegistry
| Modifier and Type | Method and Description |
|---|---|
AsyncHttpClient |
addOrReplace(String name,
AsyncHttpClient client)
Registers this instance of AsyncHttpClient with this name and returns
back a null if an instance with the same name never existed but will return back the
previous instance if there was another instance registered with the same
name and has been replaced by this one.
|
void |
clearAllInstances()
Removes all instances from this registry.
|
AsyncHttpClient |
get(String name)
Returns back the AsyncHttpClient associated with this name
|
Set<String> |
getAllRegisteredNames() |
boolean |
registerIfNew(String name,
AsyncHttpClient client)
Will register only if an instance with this name doesn't exist and if it
does exist will not replace this instance and will return false.
|
boolean |
unregister(String name)
Remove the instance associate with this name
|
AsyncHttpClient get(String name)
name - the name of the client instance in the registryAsyncHttpClient addOrReplace(String name, AsyncHttpClient client)
name - the name of the client instance in the registryclient - the client instanceboolean registerIfNew(String name, AsyncHttpClient client)
AsyncHttpClient ahc = AsyncHttpClientFactory.getAsyncHttpClient();
if(!AsyncHttpClientRegistryImpl.getInstance().registerIfNew(“MyAHC”,ahc)){
//An instance with this name is already registered so close ahc
ahc.close();
//and do necessary cleanup
}
name - the name of the client instance in the registryclient - the client instanceboolean unregister(String name)
name - the name of the client instance in the registryvoid clearAllInstances()
Copyright © 2017. All Rights Reserved.