I have a static function in a Class which is called by a Servlet. Suppose, if 100 requests come at a time, will that function be available for all the requests?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
All the requests get processed by the same VM, in the same process, but different threads. So yes, any static members are available to all requests.
Be aware though that if you change static data from those multiple threads, you would do good to synchronize on that data for thread safety. or use ThreadLocal objects, these will be distinct for every thread.