Reputation: 90101
I am using the Whole Message Delivery functionality of Jetty Websockets. In such a case, Joakime says that Websocket messages are guaranteed to be delivered in order.
I am going to go on a limb and assume that all Websocket event-handling methods will be invoked by the same thread.
Now, say an external timer expires and I need to send a message over the websocket. The timer runs in one thread and the Websocket events run on a different thread.
Do I need to make my Websocket event handlers thread-safe (seeing as their state will be accessed by the timer and Websocket thread)? Or is there a way for the timer thread to pass a task to the Websocket thread to execute?
Upvotes: 0
Views: 106
Reputation: 49515
The Jetty WebSocket API (Native or javax.websocket) doesn't care about the thread safeness of the local WebSocket End Point.
It will deliver the next message when it arrives.
Note: you can control suspend / resume of the read thread with the Jetty Native WebSocket API.
Upvotes: 1