eclipse-ee4j / eclipse-ee4j/tyrus
Customize ExecutorServices to be used by ClientManager
- Dominant language
- Java
- Stars
- 128
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
A little background to the need of such thing:
We want to connect to several different websocket-servers (lets say ~ 150).
The application runs in a container *where no* managed executor-services can be retreived via jndi-lookups. Therefore the ClientManager (or rather BaseContainer) will maintain its own thread-pools.
If we use a ClientManager per connection the thread usage is way to high (10 schedule-exec threads + 1-2 worker-threads = ~1800 threads)
If we share the same ClientManager accross all connections the reconnects are a bottleneck (only 10 threads for reconnects accross 150 connections). Furthermore we ran into the issue #640 from time to time.
One approach (because it seems that I'm the only one needing this) is a better extendability of the class `org.glassfish.tyrus.client.ClientManager`.
Currently the only visible constructor is the default one which internally calls the private constructor `ClientManager(String containerProviderClassName, WebSocketContainer webSocketContainer)`. Therefore any extending class is required to use grizzly-client as container-provider.
I want to use the jdk-client so it would be helpful to have the constructor `ClientManager(String containerProviderClassName, WebSocketContainer webSocketContainer)` changed to visiblity `protected`
After that I would be able to override the methods `BaseContainer.getExecutorService()` and `BaseContainer.getScheduledExecutorService()` to return executor-services that are especially configured/customized (in terms of sizing etc.) for our needs.
Of course any other way to pass preconfigured executor-services would be sufficient, too (e.g. passing them via the ClientProperties).
Contributor guide
Assessment
This issue has not been assessed yet.