Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 26921 invoked from network); 9 Oct 2002 10:29:24 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 9 Oct 2002 10:29:24 -0000 Received: (qmail 1537 invoked by uid 97); 9 Oct 2002 10:30:18 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 1521 invoked by uid 97); 9 Oct 2002 10:30:18 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 1496 invoked by uid 98); 9 Oct 2002 10:30:17 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: Wed, 9 Oct 2002 12:29:47 +0200 Subject: Re: HttpSessionListener Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v546) From: Andreas Junghans To: "Tomcat Developers List" Content-Transfer-Encoding: 7bit In-Reply-To: <200210071059.01769.jbaker@teamenergy.com> Message-Id: <08FAEED5-DB72-11D6-8FF4-000393B8F6A6@fh-karlsruhe.de> X-Mailer: Apple Mail (2.546) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N John Baker wrote: > I'm trying to write a bean so when sessions are closed, database > connections > and other resources are released. I realise when the sessionDestroyed > method > is called on HttpSessionListener the session is already invalidated (I > would > like to know why such a design decision was made there, it seems > wrong). > Anyway, as I need to be able to map stuff to a session I'm trying to > write a > listener where I can say "For this newly created session, hold on to > this > object". So when the session is destroyed, the object can be retrieved > and > methods called upon it (such as close db connections). This question should be directed at tomcat-user@jakarta.apache.org. You're right that you cannot use HttpSessionListener since that is only an after the fact notification. For things like this, I usually use a session attribute that implements HttpSessionBindingListener. In its valueUnbound() method, you can perform cleanup actions for the session. Regards Andreas Junghans -- To unsubscribe, e-mail: For additional commands, e-mail: