well. a session cannot contain a thing like a thread or a database connection because everything in session must be serializable.
-igor On Mon, Jun 23, 2008 at 10:14 AM, Zappaterrini, Larry <[EMAIL PROTECTED]> wrote: > Say for instance the session contains a resource such as a database > connection or a thread (Eyal's original question) that needs to be freed > when the session is invalidated. Is there (or should there) be a more > intuitive way to handle this use case than Nino's solution of providing > a custom ISessionStore? Perhaps some other callback on Session such as > onUnbind. Maybe this isn't a common enough use case to warrant a new > method though. > > Thanks, > Larry > > -----Original Message----- > From: Igor Vaynberg [mailto:[EMAIL PROTECTED] > Sent: Monday, June 23, 2008 12:48 PM > To: [email protected] > Subject: Re: Session end method > > what resources are those? like i said before, by the time you get > notification that the session is expired you can no longer access > attributes within session. > > -igor > > On Mon, Jun 23, 2008 at 8:29 AM, Zappaterrini, Larry > <[EMAIL PROTECTED]> wrote: >> I see. So then would the best place to do session cleanup be in >> WebApplication.sessionDestroyed? >> >> I guess the question really boils down to: where is the best place to >> clean up session related resources to ensure that they are freed in > all >> instances regardless of which ISessionStore implementation is used? >> >> Thanks, >> Larry >> >> -----Original Message----- >> From: Igor Vaynberg [mailto:[EMAIL PROTECTED] >> Sent: Monday, June 23, 2008 11:11 AM >> To: [email protected] >> Subject: Re: Session end method >> >> session.invalidate() triggers the invalidation, just like it does in >> httpsession. you might want to read the javadoc. >> >> -igor >> >> On Mon, Jun 23, 2008 at 6:29 AM, Zappaterrini, Larry >> <[EMAIL PROTECTED]> wrote: >>> Ah, I see that now. I didn't dig deep enough. When I first started >>> working with Wicket sessions I was assuming (bad I know!) that >>> Session.invalidate would be called when the HttpSession timed out. I >>> noticed that it actually wasn't, so I then assumed (again!) that >> Wicket >>> wasn't handling any HttpSession time outs. Would it make sense to > have >>> Wicket call Session.invalidate when the HttpSession times out to >>> simplify this use case and not require implementing ISessionStore? >>> >>> -----Original Message----- >>> From: Johan Compagner [mailto:[EMAIL PROTECTED] >>> Sent: Saturday, June 21, 2008 3:23 AM >>> To: [email protected] >>> Subject: Re: Session end method >>> >>> Wicket doea that for you, unbind is called when session is > terminarted >>> by the container >>> >>> On 6/20/08, Zappaterrini, Larry <[EMAIL PROTECTED]> wrote: >>>> Assuming this is backed by an HttpSession, wouldn't you also have to >>>> register an implementation of HttpSessionListener via web.xml to >>> handle >>>> the situation where the HttpSession times out? Correct me if I'm >>> wrong, >>>> but in that instance, onUnbind will not be called and the Thread >> would >>>> never be stopped. >>>> >>>> -----Original Message----- >>>> From: Nino Saturnino Martinez Vazquez Wael >>>> [mailto:[EMAIL PROTECTED] >>>> Sent: Friday, June 20, 2008 3:03 AM >>>> To: [email protected] >>>> Subject: Re: Session end method >>>> >>>> Theres also an unsecure way of doing it, namely this(from >>>> applicationclass): >>>> >>>> @Override >>>> protected ISessionStore newSessionStore() { >>>> return new SecondLevelCacheSessionStore(this, new >>>> DiskPageStore()) { >>>> @Override >>>> protected void onBind(Request request, Session >> newSession) >>> { >>>> >>>> sessionMap.put(newSession.getId(), (ZeuzSession) >>>> newSession); >>>> super.onBind(request, newSession); >>>> } >>>> >>>> @Override >>>> protected void onUnbind(String sessionId) { >>>> ZeuzSession session = (ZeuzSession) >>>> sessionMap.get(sessionId); >>>> session.onBeforeDestroy(); >>>> sessionMap.remove(sessionId); >>>> super.onUnbind(sessionId); >>>> } >>>> >>>> }; >>>> } >>>> >>>> >>>> Eyal Golan wrote: >>>>> Hello, >>>>> Is there a method in Session that is called when the Session is >>> ended? >>>>> Ended = user logs out (invalidate) or time-out (or anything else >> that >>>> can do >>>>> that) >>>>> >>>>> My goal is to keep some information in the session and persist it >>> when >>>> the >>>>> session terminates. >>>>> >>>>> Is it "legal" to create a Thread (as a member in the Session / >>>> Application) >>>>> that every X minutes will get information from the Session and "do >>>> something >>>>> with it"? >>>>> >>>>> >>>> >>>> -- >>>> -Wicket for love >>>> >>>> Nino Martinez Wael >>>> Java Specialist @ Jayway DK >>>> http://www.jayway.dk >>>> +45 2936 7684 >>>> >>>> >>>> > --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> ______________ >>>> >>>> The information contained in this message is proprietary and/or >>>> confidential. If you are not the >>>> intended recipient, please: (i) delete the message and all copies; >>> (ii) do >>>> not disclose, >>>> distribute or use the message in any manner; and (iii) notify the >>> sender >>>> immediately. In addition, >>>> please be aware that any message addressed to our domain is subject >> to >>>> archiving and review by >>>> persons other than the intended recipient. Thank you. >>>> _____________ >>>> >>>> > --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>> >>> -- >>> Sent from Gmail for mobile | mobile.google.com >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> ______________ >>> >>> The information contained in this message is proprietary and/or >> confidential. If you are not the >>> intended recipient, please: (i) delete the message and all copies; >> (ii) do not disclose, >>> distribute or use the message in any manner; and (iii) notify the >> sender immediately. In addition, >>> please be aware that any message addressed to our domain is subject > to >> archiving and review by >>> persons other than the intended recipient. Thank you. >>> _____________ >>> >>> --------------------------------------------------------------------- >>> 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] >> >> ______________ >> >> The information contained in this message is proprietary and/or > confidential. If you are not the >> intended recipient, please: (i) delete the message and all copies; > (ii) do not disclose, >> distribute or use the message in any manner; and (iii) notify the > sender immediately. In addition, >> please be aware that any message addressed to our domain is subject to > archiving and review by >> persons other than the intended recipient. Thank you. >> _____________ >> >> --------------------------------------------------------------------- >> 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] > > ______________ > > The information contained in this message is proprietary and/or confidential. > If you are not the > intended recipient, please: (i) delete the message and all copies; (ii) do > not disclose, > distribute or use the message in any manner; and (iii) notify the sender > immediately. In addition, > please be aware that any message addressed to our domain is subject to > archiving and review by > persons other than the intended recipient. Thank you. > _____________ > > --------------------------------------------------------------------- > 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]
