Skip to content

Instantly share code, notes, and snippets.

@cemartins
Created October 5, 2014 23:11
Show Gist options
  • Save cemartins/fc4647560545f2f91001 to your computer and use it in GitHub Desktop.
Save cemartins/fc4647560545f2f91001 to your computer and use it in GitHub Desktop.
Starting Tyrus ClientManager
ClientManager client = AccessController.doPrivileged(new PrivilegedExceptionAction<ClientManager>() {
@Override
public ClientManager run() throws Exception {
ThreadPoolConfig workerThreadPoolConfig = ThreadPoolConfig.defaultConfig();
workerThreadPoolConfig.setInitialClassLoader(this.getClass().getClassLoader());
workerThreadPoolConfig.setDaemon(false);
workerThreadPoolConfig.setMaxPoolSize(4);
workerThreadPoolConfig.setCorePoolSize(3);
ClientManager cm = ClientManager.createClient(JdkClientContainer.class.getName());
cm = ClientManager.createClient(JdkClientContainer.class.getName());
cm.getProperties().put(ClientProperties.SHARED_CONTAINER, false);
cm.getProperties().put(ClientProperties.WORKER_THREAD_POOL_CONFIG, workerThreadPoolConfig);
cm.asyncConnectToServer(websocketClientEndpoint, serverEndpointAddress);
return cm;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment