Hi all, with my servlet application, I need to make use of application variable. Each request for the servlet will need an access to application variable and add some data to application var. and store back. but what if two requests were made at the same time? Can this be an issue like in Java Multithreaded application ? or does servelt engine handle this? Thanks in advance
Sean <br />SCJP2, SCJP2p1.4, SCWCD
Joined: Nov 06, 2000
Yes, access by two threads at the same time can be a problem. Just synchronize access to the variable. ------------------ Bosun SCJP for the Java� 2 Platform
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Joined: Oct 09, 2001
Originally posted by Bosun Bello: Yes, access by two threads at the same time can be a problem. Just synchronize access to the variable.
Is this dependent on the server? I mean I can understand that Tomcat requires it, but I would have thought the Weblogic would take care of it for the Application object. Adam
I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Why should it be? Multithreading support as a means is a core component of Java. EJBs have their innards protected -- from EXTERNAL synchronization issues -- as part of the remoting process, but servlets are just classes and they are quite capable of being managed by the much lighter weight facilities that are built into Java.
Customer surveys are for companies who didn't pay proper attention to begin with.