If the server connection fails, this code will continue to be used during the reconnection.
But each execution of this code creates eight threads of WebSocketClient@xxx-xxx
The connection pool cannot be automatically destroyed if the connection fails.
My code ContainerProvider.getWebSocketContainer();
-> org.eclipse.jetty.websocket.jsr356.ClientContainer<111 line> - > public ClientContainer()
-> WebSocketClient<95 line>->public WebSocketClient()
-> DefaultHttpClientProvider.get
-> DefaultHttpClientProvider.newHttpClient
Reconnecting will create a new thread pool and 8 threads. How do I close this object? Can't you create a Websocket client this way in Jetty?
Jetty Version Jetty 9.4.53
Jetty Environment linux jetty run command: ./bin/jetty.sh run
Java Version 1.8.0_371 x64
Question I used this code to create a Websocket client connection
If the server connection fails, this code will continue to be used during the reconnection. But each execution of this code creates eight threads of WebSocketClient@xxx-xxx The connection pool cannot be automatically destroyed if the connection fails. My code
ContainerProvider.getWebSocketContainer();
->org.eclipse.jetty.websocket.jsr356.ClientContainer
<111 line> - >public ClientContainer()
->WebSocketClient
<95 line>->public WebSocketClient()
->DefaultHttpClientProvider.get
->DefaultHttpClientProvider.newHttpClient
Reconnecting will create a new thread pool and 8 threads. How do I close this object? Can't you create a Websocket client this way in Jetty?