Skip to content

Instantly share code, notes, and snippets.

@leviyehonatan
Created September 12, 2012 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leviyehonatan/3708357 to your computer and use it in GitHub Desktop.
Save leviyehonatan/3708357 to your computer and use it in GitHub Desktop.
show usage of ThreadSafeClientConnManager
public class Test {
private <T> T createRestService(Class<T> clazz, String address) {
ClientConnectionManager cm = new ThreadSafeClientConnManager();
HttpClient httpClient = new DefaultHttpClient(cm);
ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);
return ProxyFactory.create(clazz, address, executor);
}
public void setInvokerAddress(String address) {
Invoker invoker = createRestService(Invoker.class, address));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment