Thanks Leon for replying. I wanted to give a bit of feedback on this issue. It turns out that Concurrency was not the issue at all. The real problem was concealed by something that I am still puzzled about.
Apparently when an HttpSessionListener class has an exception, it is never sent to catalina.out or catalina.err (I do not have log4j setup) and because of this, a problem with my logic was never being noticed. During a sessionDestroyed() event I was attempting to cleanup old session beans that I personally created, only there was an exception that occurred and thus a memory leak. I never had any output for the run time exception in a log file... Is this a known issue? -Dennis Klotz -----Original Message----- From: Leon Rosenberg [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 3:39 PM To: Tomcat Users List Subject: Re: Concurrency question for servlets Hi, from the tomcat source package org.apache.catalina.core; public class ApplicationContext implements ServletContext { .... public Object getAttribute(String name) { synchronized (attributes) { return (attributes.get(name)); } } to answer your question: > Question: > > Do I need to put the getServletContext().getAttribute() inside of a > synchronized (this) block? I am thinking I do. > nope :-) It's already synchronized. Leon Btw, why should concurrency issues produce a memory leak? A dead lock or an infinite loop -> absolutely, but memory leaks? Would be first time I met this issue, but you're never too old to learn :-) On 3/14/06, Klotz Jr, Dennis <[EMAIL PROTECTED]> wrote: > Hello. > > I hope everyone is having a great day! I hope you have a moment for a > quick question. > > I am fighting a memory leak problem and I want to try and rule in or out > concurrency issues. So given: > > Servlet Code: > > ----- > > public enum XMSContextAttributes { applicationContext }; > > public void doGet (HttpServletRequest req, HttpServletResponse res) > throws ServletException, IOException > { > HXMSApplicationContext applicationContext; > > applicationContext = getServletContext ().getAttribute > (XMSContextAttributes.applicationContext.name ()); > > ...do something useful here... > } > > ----- > > Notes: > > The applicationContext object is being created by a > ServletContextListener, and it contains two important ConcurrentHashMap > objects. > > But the applicationContext object itself has no concurrency > protection... I access it inside of the doGet of certain servlets... > > Question: > > Do I need to put the getServletContext().getAttribute() inside of a > synchronized (this) block? I am thinking I do. > > Thank you. > > -Dennis Klotz > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]