Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 87505 invoked from network); 19 Sep 2007 10:05:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Sep 2007 10:05:40 -0000 Received: (qmail 78901 invoked by uid 500); 19 Sep 2007 10:05:19 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 78863 invoked by uid 500); 19 Sep 2007 10:05:19 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 78851 invoked by uid 99); 19 Sep 2007 10:05:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2007 03:05:19 -0700 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of delbd+jakarta@oma.be does not designate 195.238.6.179 as permitted sender) Received: from [195.238.6.179] (HELO mailrelay012.isp.belgacom.be) (195.238.6.179) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2007 10:05:17 +0000 Received: from 226.81-245-81.adsl-dyn.isp.belgacom.be (HELO yuki.local) ([81.245.81.226]) by mailrelay012.isp.belgacom.be with ESMTP; 19 Sep 2007 12:04:56 +0200 X-Belgacom-Dynamic: yes Message-ID: <46F0F449.2020106@oma.be> Date: Wed, 19 Sep 2007 12:04:57 +0200 From: David Delbecq User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: How do you access all sessions from a servlet in tomcat 6.0? References: <28174dd80709180025o7f7c9534ra8b499ee765c52b@mail.gmail.com> <28174dd80709182046s678cb003j2035d2cfb31b673b@mail.gmail.com> <28174dd80709190238k27a7aa1csbec1be83da4c76d3@mail.gmail.com> In-Reply-To: <28174dd80709190238k27a7aa1csbec1be83da4c76d3@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Just use WeakReference :) Lyallex a �crit : > OK, for some reason I've been obsessing about this for a whole day now. > > If you hold an external reference to a Session then according to my > tests the session will still time out as expected but the external > reference will be non null. At the very least this means that you may > end up with a large number of useless references taking up space in > memory. Of course you can always remove an invalid or timed out > reference in the sessionDestroyed method of your listener. > > There are a whole bunch of other issues surrounding this but I'm sure > you've sussed them out for yourself already. > > Anyway, I'll shut up now. > > Rgds > Duncan > > > On 9/19/07, Lyallex wrote: > >> On 9/18/07, Lyallex wrote: >> >>> How about creating a SessionListener >>> >>> class SomeSessionListener implements HttpSessionListener ... >>> >>> Register it in web.xml >>> >>> in the sessionCreated method of your listener get a reference to the >>> new session from the HttpSessionEvent you can now access the >>> getLastAccessedTime(), maybe store the refs in some singleton ... >>> >> ...er, actually I think this could be a REALLY STUPID idea as I hadn't >> thought about what happens if you maintain an external reference to a >> session and the session expires... >> >> Investigating now >> >> Duncan >> >> > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org