carox kaur wrote:Book says that local variables inside the service method (or more exactly any of doXXX methods) are thread safe but the instance variables in the servlet class are not thread safe i.e they are accessible by the multiple threads. I have not understood this....
Book says that local variables inside the service method (or more exactly any of doXXX methods) are thread safe but the instance variables in the servlet class are not thread safe i.e they are accessible by the multiple threads.
In your first block of code think of object 't' as it is created by container. No more objects will be created ther after for the same servlet/class
In your first block of code think of object 't' as it is created by container. No more objects will be created ther after for the same servlet/class
And so this problem was solved by setting any data in the form of attribute in any object (Session, Request or context) scope, whichever seems apt.
I guess everyone has an angle. Fine, what do you want? Just know that you cannot have this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|