Add name on WebSocketComponents default threadpool

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-08-04 16:49:15 +10:00
parent 316c46675e
commit edec52893b
3 changed files with 12 additions and 6 deletions

View File

@ -57,7 +57,17 @@ public class WebSocketComponents extends ContainerLifeCycle
_bufferPool = (bufferPool == null) ? new MappedByteBufferPool() : bufferPool;
_inflaterPool = (inflaterPool == null) ? new InflaterPool(CompressionPool.DEFAULT_CAPACITY, true) : inflaterPool;
_deflaterPool = (deflaterPool == null) ? new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.DEFAULT_COMPRESSION, true) : deflaterPool;
_executor = (executor == null) ? new QueuedThreadPool() : executor;
if (executor == null)
{
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setName("WebSocket@" + hashCode());
_executor = threadPool;
}
else
{
_executor = executor;
}
addBean(_inflaterPool);
addBean(_deflaterPool);

View File

@ -85,10 +85,6 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketPoli
{
coreClient = new WebSocketCoreClient(httpClient, components);
addManaged(coreClient);
if (httpClient == null)
coreClient.getHttpClient().setName("Jetty-WebSocketClient@" + hashCode());
frameHandlerFactory = new JettyWebSocketFrameHandlerFactory(this, components);
sessionListeners.add(sessionTracker);
addBean(sessionTracker);

View File

@ -41,7 +41,7 @@ public class HttpClientInitTest
assertThat("Executor exists", executor, notNullValue());
assertThat("Executor instanceof", executor, instanceOf(QueuedThreadPool.class));
QueuedThreadPool threadPool = (QueuedThreadPool)executor;
assertThat("QueuedThreadPool.name", threadPool.getName(), startsWith("WebSocketClient@"));
assertThat("QueuedThreadPool.name", threadPool.getName(), startsWith("WebSocket@"));
}
finally
{