On Thu, 11 Apr 2002, Claude HONNORE wrote: > Bonjour > > It is very curious, but the behaviour of servlet container are > different between Resin, Tomcat and ServletExec when I implement > SingleThreadModel in a servlet > > the results are incoherent and are not the same in each of my 3 > frames, when I don't implement SingleThreadModel in my servlet and > it is normal, beacause the design of the servlet .. > > So I implements SingleThreadModel in my servlet and when I call in > the same time 3 instances of this servlet ( it is easy, I put a > Thread.sleep(100) in my servlet, and I call three instance of this > servlet in 3 frames distincts, in the same time ) the results is > different between the 3 servlet containers .. > > With Tomcat and servletexec, the 3 results of the 3 instances are > differents, and it seems that the 3 instances or at least 2 are > executed in parallel.. With resin 2.10, the 3 instances are exactly > executed in sequence so the 3 results are good and equals.. > > I change nothing between the tests except the servlet container .. > > bizarre ...
Well, first of all, I don't think this is so surprising, because the spec doesn't always say exactly how things must work, so there is some room for differences in implementations. In terms of SingleThreadModel specifically, one option is to allow a pool of servlet instances, but I don't think the spec either requires or disallows that (I believe it does specify that there can only be a single instance -- per servlet definition -- if SingleThreadModel is not implemented). However, instead of investing much time investigating these behavior differences, I'd suggest analyzing/redoing your servlet to make it work properly in a multi-threaded environment, so you wouldn't have to use SingleThreadModel, which is not really a good solution. You can do this by eliminating any concurrency issues, or reducing them as much as possible and using synchronized appropriately. Milt Epstein Research Programmer Software/Systems Development Group Computing and Communications Services Office (CCSO) University of Illinois at Urbana-Champaign (UIUC) [EMAIL PROTECTED] ___________________________________________________________________________ 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
