On 24/03/2014 16:08, John Smith wrote:
> I should know this, but I want to confirm with smarter people on the board.
> 
> Assume the following:
> 1. Servlet receives an HTTP POST request. doPost(...) is called.
> 2. doPost(..) instantiates class X with each request
> 3. Class X calls a static method of class Y
> 
> Assuming I have no synchronization in the method signature or body of Y,
> there is a danger of concurrency issues or thread safety issues. Many
> instances of X can call Y's static method at the same time, causing BAD
> THINGS to happen.

It depends on how Y's static method is written.

If the method is thread-safe - no issue. If it isn't thread-safe then
you have a problem.

Mark


> 
> True? I swear I used to know this but I've worked on so much stuff for this
> project in the last few months it simply fell out of my brain :). I'm also
> aware that the answer to this is often "it depends" but I'm looking for the
> general case answer.
> 
> TIA
> John
> 


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

Reply via email to