tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Rosenberg <>
Subject RE: Tomcat/JVM hangs in session.getAttribute / HashMap.get()
Date Tue, 06 Sep 2005 14:29:33 GMT

> > If I understand you correctly your scenario is:
> > HashMap Entry has a linked list of X entries at one position 
> > and entry[Y] is poiting to the first entry instead of next or null?
> Correct.
> > But how can that happen? a JVM / Core Api bug?
> The error is likely in webapp code, since the Servlet spec leaves
> it up to the webapp to implement thread safe setting and update of
> session objects.  I haven't researched the HashMap source code to
> see exactly how this situation can come about, so I can't say
> exactly what to look for.  Thus, the not terribly helpful advice
> is to examine for thread safety each location where the session is
> written.

Ok understood, just to be sure. In a util class I do following:

public void addBeanToSession(HttpServletRequest req, String beanName,
Object beanValue){
  HttpSession session = req.getSession();
     session.setAttribute(beanName, beanValue);

and replace all req.getSession().setAttribute(beanName, beanValue) in
code with the call to this method (same for remove) and I've solved my

thanx for your help

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

View raw message