-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #6566 - add executor to WebSocketComponents & use for Dispatched Messages #6585
Issue #6566 - add executor to WebSocketComponents & use for Dispatched Messages #6585
Conversation
…d Messages Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
...ebsocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java
Outdated
Show resolved
Hide resolved
...-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java
Show resolved
Hide resolved
Signed-off-by: Lachlan Roberts <[email protected]>
…erTest Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
if (executor == null) | ||
{ | ||
QueuedThreadPool threadPool = new QueuedThreadPool(); | ||
threadPool.setName("WebSocket@" + hashCode()); | ||
_executor = threadPool; | ||
} | ||
else | ||
{ | ||
_executor = executor; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are breaking out like this, then you may as well do:
if (executor == null) | |
{ | |
QueuedThreadPool threadPool = new QueuedThreadPool(); | |
threadPool.setName("WebSocket@" + hashCode()); | |
_executor = threadPool; | |
} | |
else | |
{ | |
_executor = executor; | |
} | |
if (executor == null) | |
{ | |
QueuedThreadPool threadPool = new QueuedThreadPool(); | |
threadPool.setName("WebSocket@" + hashCode()); | |
_executor = threadPool; | |
addBean(_executor, true); | |
} | |
else | |
{ | |
_executor = executor; | |
addBean(_executor, false); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm but then all the other beans are managed differently..... I still don't like how the management decision is made external to this class... but I'll live with it in this PR. But do think about fixing it sometime.
Issue #6566
Use an executor to dispatch new threads for
InputStream
orReader
type messages.This doesn't fix #6566 as that issue was also reproduced using the
onMessage(ByteBuffer)
style methods. But this should still offer some improvement for dispatched messages.