Hi,

On 6/14/23 19:43, Mark Thomas wrote:
[...]
There is no multi-threading within a single WebSocket connection. It is explicitly not allowed by the Jakarta WebSocket specification and Tomcat follows that rule.

Could you please point out where such guarantee is implemented exactly? From what I can see in 9.0.36 source code the call chain down to onMessage is apparently as follows:

  WsFrameServer.notifyDataAvailable()
 --> WsFrameServer.doOnDataAvailable()
  --> WsFrameServer.onDataAvailable()
   --> WsFrameBase.processInputBuffer()
    --> WsFrameBase.processData()
     --> WsFrameBase.processDataBinary()
      --> WsFrameBase.sendMessageBinary(...)
       --> binaryMsgHandler.onMessage(...)

In notifyDataAvailable one can see some changeReadState(ReadState.WAITING, ReadState.PROCESSING) before calling onDataAvailable() and changeReadState(ReadState.PROCESSING, ReadState.WAITING) after. Is it the thing that is supposed to protect against concurrent (and/or out-of-order) calling of onMessage?

Because other than that, I could not find anything relevant.


Thank you,

Regards,
Nikolai

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to