Re: Tomcat 9, websocket server, threading

2023-06-17 Thread Nikolai Zhubr

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



AW: Words of Wisdom re: Context Versioning - Parallel Deployment

2023-06-17 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello Dan,

> -Ursprüngliche Nachricht-
> Von: Dan McLaughlin 
> Gesendet: Freitag, 16. Juni 2023 18:54
> An: Tomcat Users List 
> Betreff: Words of Wisdom re: Context Versioning - Parallel Deployment
> 
> Does anyone have any advice on implementing Context Versioning (parallel
> deployment) in Tomcat? It seems to have been a feature for quite some
> time.
> Is it stable?   What are the typical issues people run into? JMX issues?
> Classloader issues?
> 
> I've tried to do a parallel deployment with our applications as they exist
> today, and I can already see a few problems we'd have to address.
> 
> 1) We have a concept of a workdir where we will extract configuration-
> related properties files, XML, etc... on initial start-up; the workdir also
> contains working files related to things like XA transaction logs and
> application-specific logging. We'd probably need to append the context
> version to our workdir path so that each version can have separate
> application logs, configuration settings, etc...
> 
> 2) We use JMX MBeans throughout our apps to allow real-time configuration
> of our applications. Since our apps weren't originally developed with parallel
> deployment in mind, so a parallel deployment results in two app versions
> trying to use the same JMX MBeans. I can see in our app logs when I try to
> deploy two versions, the second version will either throw an exception and
> fail to start because the MBean exists, or it will try to destroy and recreate
> the MBean--which could cause issues if it changes a setting that the first
> version of the app depended on. I assume we will need to fix all our code to
> somehow version the MBeans so there aren't conflicts.
> 
> 3) Do third-party dependencies that use JMX pose any issues? We use jgroups
> and log4j2. Both create their own mbeans, but it seems we have control over
> the names they use.
> 
> Do you know if there are any other issues we need to consider? Words of
> wisdom?
> 
> Thanks!
> 
> Dan
> 

Just some thoughts / ideas from my side:
a) If you use any scheduler (e.g. quartz) you must use a DB based 
synchronization / clustering
b) When using caches, they must be synchronized between the two apps
c) Some frameworks have built-in caches which must be taken into account (e.g. 
eclipse link)
d) Any shared resources should be checked whether parallel access might cause 
problems
e) Opening listening ports might conflict

I would like to try this feature in future. The above mentioned are some 
thoughts I made up to now.

Greetings,
Thomas

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