HI Gokul, thanks for the response but thats not the probleme cause the counter variable is just a test and the threads A and B are me on different machines and I am not so fast -:) regds, rachid On Wed, 09 Aug 2000, you wrote: > Hi, > > the problem here seems to be this.. > the variable SuperCounter is being accessed by multiple threads which are > trying to change its value simultaneously (assuming you have more than one > request at a time since more than one instance of the singleThreadModel is > created...) > I think if you try to synchronize the variable SuperCounter your problem > may get solved... > but there is a race condition in the code > > ++SuperCounter; > sessionId=SuperCounter; > > for example thread A may come and increment SuperCounter and then Thread B > may also increment SuperCounter before thread A has a chance of assigning it > to the sessionID.. > try to reimplement it as sessionID = ++SuperCounter; > > I think this should solve your problem.. > > regds, > Gokul ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
