Hello,

If WebsockectClient class is initialized without a parameter, it launches
about 8 threads (1 for internal scheduling, 7 threads for working). Why is
it designed to work on multi threads as default? What is typical use case
for multi threads?

In my projects, we found that we could not guarantee message order with
default setting (multithread) because of a context switch. For example,
even if WebsocketClient receive message A then B, message B  might be
processed first in a @OnWebsocketMessage callback if a context switch
happens.

We care message order in my project, so we usually specify an executor like
below.

WebsocketClient client = new
WebsocketClient(Executors.newFixedThreadPool(2));

(Note) We need at least two threads, one for internal scheduling and the
another for actual working thread.

Thanks,
Yohei Onishi
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to