public interface AsyncHttpClientRegistry
| Modifier and Type | Method and Description |
|---|---|
AsyncHttpClient |
addOrReplace(String name,
AsyncHttpClient ahc)
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 clientName)
Returns back the AsyncHttpClient associated with this name
|
Set<String> |
getAllRegisteredNames()
Returns back all registered names
|
boolean |
registerIfNew(String name,
AsyncHttpClient ahc)
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 clientName)
clientName - AsyncHttpClient addOrReplace(String name, AsyncHttpClient ahc)
name - ahc - boolean registerIfNew(String name, AsyncHttpClient ahc)
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 - ahc - boolean unRegister(String name)
name - Set<String> getAllRegisteredNames()
void clearAllInstances()
Copyright © 2015. All Rights Reserved.