I'm not talking about EJBs, but rather about any Tomcat-specific passivation that is done for HttpSessions that haven't been accessed in a while (just a memory use optimization).
Regarding my question in general, I'm wondering (maybe this is more of a serialization question in general), if the container decides to serialize to disk a session with 10 attributes, and the following happens, wouldn't it result in an inconsistent serialized session? The container's thread finishes writing the first 5 attributes to disk, then a request's thread updates two session attributes (one from the first 5, one from the next 5), then the container writes the next 5 attributes to disk. You'd have an inconsistent serialized view, right? With only one of the two attribute updates reflected in the session. Sure, you'd assume that once a request accesses the session, the passivation would stop. Nonetheless, what thread-safety issues might arise with Tomcat in this case and others? I'm asking more for learning than any particular issue I'm having. mgainty wrote: > > I found this doc applicable > "You can pass the HttpSession as parameter to an EJB method, only if all > objects in session are serializable. > This has to be consider as passed-by-value, that means that it's read-only > in the EJB. > If anything is altered from inside the EJB, it won't be reflected back to > the HttpSession of the Servlet Container" > > More to the point of your test scenario: > The pass-by-reference can be used between EJBs Remote Interfaces, as they > are remote references. > While it is possible to pass an HttpSession as a parameter to an EJB > object, > it is considered to be bad practice in terms of object-oriented design. > This is because you are creating an unnecessary coupling between back-end > objects (EJBs) and front-end objects (HttpSession). > > In any case could you post an the aforementioned where the session > attributes are being modified so we can look at it.. > > Thanks/ > M-- > This email message and any files transmitted with it contain confidential > information intended only for the person(s) to whom this email message is > addressed. If you have received this email message in error, please > notify > the sender immediately by telephone or email and destroy the original > message without making a copy. Thank you. > > ----- Original Message ----- > From: "Bill Barker" <[EMAIL PROTECTED]> > To: <users@tomcat.apache.org> > Sent: Friday, September 07, 2007 10:33 PM > Subject: Re: Concurrency with HttpSession > > >> >> "lightbulb432" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> >>> I'm reading some book concurrency books that talk about potential thread >>> safety issues with HttpSession. Specific cases follow: >>> >>> - When the web container passivates an HttpSession while a user's >>> request >>> modifies it >> >> Should be rare, but I don't see anything in the TC code to prevent it >> from >> happening on edge cases. If someone can construct an example, I'd be >> more >> than happy to look into it. >> >>> - When the web container replicates an HttpSession while a user's >>> request >>> modifies it >> >> I believe that with pessimistic locking, this shouldn't happen. But I'm >> not an expert on the TC replication code :). >> >> >>> - When multiple quick, successive requests from the same user access the >>> same HttpSession >>> >>> Could somebody explain how Tomcat deals with the first two, and what >>> steps >>> web application developers need to take to avoid concurrency problems >>> with >>> all three cases above? Is it guaranteed that the passivated/replicated >>> object is always a consistent view of the HttpSession? >>> >>> Thanks. >>> -- >>> View this message in context: >>> http://www.nabble.com/Concurrency-with-HttpSession-tf4403264.html#a12561600 >>> Sent from the Tomcat - User mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To start a new topic, e-mail: users@tomcat.apache.org >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> >> >> >> --------------------------------------------------------------------- >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Concurrency-with-HttpSession-tf4403264.html#a12575563 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]