Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 84501 invoked from network); 6 Oct 2005 14:12:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Oct 2005 14:12:03 -0000 Received: (qmail 42962 invoked by uid 500); 6 Oct 2005 14:11:49 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 42673 invoked by uid 500); 6 Oct 2005 14:11:48 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 42662 invoked by uid 99); 6 Oct 2005 14:11:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Oct 2005 07:11:48 -0700 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=RCVD_BY_IP,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 72.14.204.196 is neither permitted nor denied by domain of rosenberg.leon@googlemail.com) Received: from [72.14.204.196] (HELO qproxy.gmail.com) (72.14.204.196) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Oct 2005 07:11:50 -0700 Received: by qproxy.gmail.com with SMTP id a39so420197qbd for ; Thu, 06 Oct 2005 07:11:25 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=rRbzkDUPim8d86mSXauebsaDLZAJ9GArfxzXwouwl6NWeEEY1RwoN7FqrJNSAea2ohVhyPb8/xoeWCmOZmZkqDPjHZowaYKDlL4HNgXgVl1ksor9wonC/QlBbuLxjaSjBkT2nzARn+DHV2A1cmq10HhgdboBynoLs+N7cY9jK1U= Received: by 10.65.114.12 with SMTP id r12mr1001248qbm; Thu, 06 Oct 2005 07:11:25 -0700 (PDT) Received: by 10.65.97.19 with HTTP; Thu, 6 Oct 2005 07:11:24 -0700 (PDT) Message-ID: <327858f40510060711u1e4cb238m77e7d66c9cabc808@mail.gmail.com> Date: Thu, 6 Oct 2005 16:11:24 +0200 From: Leon Rosenberg Reply-To: Leon Rosenberg To: Tomcat Users List Subject: Re: custom session manager In-Reply-To: <0E071FA35418D811970500508BBB98190A5B0A@ganymed.allocation.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <0E071FA35418D811970500508BBB98190A5B0A@ganymed.allocation.net> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Sorry, aber how exactly does it solves the problem of having one session per user? :-) On 10/6/05, Tobias Meyer wrote: > > -----Urspr=FCngliche Nachricht----- > > Von: Leon Rosenberg [mailto:rosenberg.leon@googlemail.com] > > Gesendet: Donnerstag, 6. Oktober 2005 11:20 > > An: Tomcat Users List > > Betreff: Re: custom session manager > > > > > > On 10/6/05, Tobias Meyer wrote: > > > > > > Or, cou could add a static hashmap to your Servlet (or a > > bean if using JSPs) > > > where you simply add the sessions with every request. You > > would have to put > > > an attribute implementing > > javax.servlet.http.HttpSessionActivationListener > > > in each session though, that removes the session from your > > hashmap when the > > > session is expired or you will end up with having many > > invalid entries in > > > your hashmap. (And I don't even know what happens if you > > keep the references > > > to those Session objects when they are recycled by tomcat) > > > We do this to keep track of our sessions within the application. > > > > If you keep your sessions in a hashmap forever they will never be > > freed by the garbage collector and you will end with an outofmemory > > error one day. > > That's why I said you need one Attribute that implements the > HttpSessionActivationListener, which, on second thought , was wrong - you > need to implement HttpSessionBindingListener. > > The Method > > public void valueUnbound(HttpSessionBindingEvent event) > > will get called automatically when the session expires, and you can add c= ode > that removes the session from the hashmap. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org