My question may seem very silly, but bare with me please. In doGet or doPost method in a
servlet that doesn't implement SingThreadModel, I instanciate an object called "MyObject".
1: public void doGet(...)
2: {
3: MyObject mo = new MyObject();
4: ...
5: //using set methods in MyObject, mo is
6: //customerized for each users that call
7: //this servlet
8: process(mo);
10: }
11:
12: private void process(MyObject mo)
13: {
14: //do something with mo
15: }
Let's say a split second later first request came in second request came in to the doGet method. By the time the first request is on the line 8, how do I know that the second request didn't changed the mo object? How do I make sure that the integrity of mo is kept? I read from somewhere that local variables and the parameters are threadsafe, but I just can't seem to understand it. Can someone explain what really happens or how it should be coded?
[ August 19, 2002: Message edited by: Servin Park ]
[ August 19, 2002: Message edited by: Servin Park ]