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 16:56:11 GMT
On 9/7/05, Caldarale, Charles R <> wrote:
> > From: Len Popp []
> > Subject: Re: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
> >
> > So if I want to *safely* call session.setAttribute or
> session.getAttribute
> > I have to make sure the calls are synchronized on session.attributes.
> Actually no - if you can find _all_ the events that can trigger
> references or udpates to session attributes, you can synchronize on any
> object you like.  The synchronize blocks internal to Tomcat then become
> redundant, but they cause no harm.

It would take me quite a while to look at all the possible code paths
inside Tomcat to figure that out. :-(

> Another option (as suggested by the HashMap javadoc) is to modify
> StandardSession to use a HashMap wrappered by
> Collections.synchronizedMap().  No idea what kind of performance impact
> that would have, but at least it would limit the changes needed to just
> one place in one file.
>  - Chuck

That would be easier, but I was hoping I wouldn't have to use a hacked
version of Tomcat.

Thanks for your explanations.

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

View raw message