multipe threads access: best way to handle

Hi,

I understand that we have issues when multiple threads access the instance variables in a servlet. Do we have the same issue with the local variables? I have a doGet method that has two lines of code.

line 1: read request parameters and create a data object.

line 2: make a call to facade to update this object in database.

What options I have to make sure that there are no concurrent access issues.

-Deepak

[449 byte] By [jumman007a] at [2007-11-26 15:06:35]
# 1
No, you don't have the same issue with local variables, new ones are created for each thread. You should either avoid adding attributes to a servlet, or synchronize access to them if they are objects (there are no issues with primitive values).
gimbal2a at 2007-7-8 8:56:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
> (there are no issues with primitive values).How is that?! Primitive values can be changed asynchronously just as Objects can. Why would you ever sync on one and not the other?
Jasprea at 2007-7-8 8:56:32 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...