You just need a new traffic cop object created at the beginning of doGet();

TrafficCop tc = new TrafficCop();

That way you are not talking to the same tc object when you say tc.add();

Ken A.



Chris Bick wrote:
Not sure I understand your last two statements.

Could you elaborate a bit more?

Thanks,
-cb



-----Original Message-----
From: Larry Meadors [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 3:42 PM
To: [EMAIL PROTECTED]
Subject: RE: Simultaneous request from same IP


TrafficCop is thread safe because add() is synchronized. Regardless if trafficcop is

No, this is false.
The add() method is syncronized, and therefore thread safe. But that is
not where the problem lies.
TrafficCop may be thread safe, but access to it is not.

Two objects are updating a single object - the last one to do it wins.

Larry

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


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




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

Reply via email to