Two requests are coming into your servlet. A SINGLE servlet object
handles BOTH requests. That single object has a SINGLE child object
(trafficCop) that gets updated once for each request. That child object
is shared by both requests - it is not unique for each request unles you
make it a method variable instead of a member variable. The first update
to trafficCop is being overwritten by the second update. 

The fact that the add() method is syncronized has no impact on this -
only one request is updating at a time. However, later when you ask for
the value that was updated, you only get the second value because there
is only one trafficCop object to get updated because it is a child of
the single servlet.

I hope this helps, but I am having a hard time explaining it so if it
does not, we will keep working on it. :-/

Larry

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to