tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Len Popp <>
Subject Re: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
Date Thu, 08 Sep 2005 02:28:37 GMT
OK, so how do I fix this problem in my application? I can't figure it out.

Inside Tomcat, references to the hashmap in question are synchronized
on the hashmap object itself, StandardSession.attributes (see
org.apache.catalina.session.StandardSession). So if I want to *safely*
call session.setAttribute or session.getAttribute I have to make sure
the calls are synchronized on session.attributes. But I can't access
session.attributes - it's a protected field and I don't see a method
that returns it. So I cannot make my setAttribute calls synchronize
properly with Tomcat's code.

I don't see how I can work around this. Am I missing something? Or do
the Tomcat guys have to fix it?

On 9/6/05, Caldarale, Charles R <> wrote:
> > From: Arup Vidyerthy []
> > Subject: RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
> >
> > Does this mean that all session.setAttribute() and
> > session.getAttribute() should always be synchronised
> That's the conclusion I'm reluctantly coming to, if there is the
> possibility of multiple threads updating the same session
> simultaneously.  Luckily, you would think that most operations would
> really be request, not session, related.
>  - Chuck
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message