Hi, I have heard people talking about creating only local variables in doPost,doGet methods for Thread Safe access. In some situations I need to call other methods from doPost, but beacuse of thread safty concerns I am passing all the variables to the called methods. Like for instance in doPost
Is there any way to make vector accessible to other methods without passing as one of the input parameters and comprimising Thread Safety ? I know I can implement SingleThreadModel but I am looking if there is any other way I can do it. Regards, Vijay
Use the method that you indicated. An alternative would be to synchronize the method, but this may produce a negative impact on performance. There is absolutely nothing wrong with your approach. You should always try to use automatic (local) variables when using servlets. good luck, SAF
What does one do when all copies of a running servlet need to know and update a set or list of values? What modifiers are on the variables, and how is the best method to synchronize it to keep the updates safe? For example, doing writes to a data or log file? Thanks!
CJP (Certifiable Java Programmer), AMSE (Anti-Microsoft Software Engineer)
Author of Posts in the Saloon
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com