Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Websockets and threading

Hi,

On Wed, Oct 26, 2011 at 00:46, Gunnar Kristjansson
<gunnar.kristjans@xxxxxxxxx> wrote:
> Hi,
>
> I want to give an existing application that already uses a NIO
> selector pattern the ability to periodically post data to clients over
> web sockets. The code seems straightforward enough. Just inheriting a
> web socket handler and storing all of the connections. What I've been
> trying to find out is how Jetty is threaded and if it's safe to call
> WebSocket.Connection SendMessage from a thread which is not managed by
> Jetty. I suppose one option would be to somehow get the existing code
> and Jetty to use the same selector. Data is only flowing out of the
> application and not into it if that makes any difference.

It is safe to call WebSocket.Connection.sendMessage(...) from any
thread, even concurrently.

Simon
-- 
http://cometd.org
http://intalio.com
http://bordet.blogspot.com
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz


Back to the top