I just thought of another way of dealing with detecting session timeout and
the "clean-up" process.  Please tell me what you think.
1. Create an Object and override its finalize() method.
2. Place that object into the session (during login).. haven't tried it yet,
but something like this: session.setAttribute ("CLEANUP",new
CleanupObject())
3. Once the user leaves the site, or closes the browser, the session will
eventually timeout, and dispose of all of its contents.. right?  And if that
is the case, then the CleanupObject will have to be garbage collected.  So,
whenever the garbage collector decides to dispose of this object, its
finalize() method will be called..

right?

---
class CleanupObject()
{
...
finalize()
{//do cleanup}
...
}


---original question---
> Here's my question...
> I have a JSP app (page centric design) with user logins.
> Every time a user logs in, he/she can modify different things
> (back end),
> but once they log out or close the browser, I want to be able
> reset all of
> the changes made by them.
>
> For example:
> 1. User logs in
> 2. User changes a table in the DB
> 3. User logs out, or leaves the page without logging out <- this part
> worries me
> 4. all of the changes in the DB should be reset to their
> original state.. or
> some other state
>
> Is there a standard way of implementing this?  I can think of
> some ways, but
> I'm afraid that they will fall into the "bad design" category.
>
> Here's what I'm thinking of doing.
> Create a singleton object, and store the references to all of
> the sessions
> there (during login process).. Once a session dies, that
> object will get
> notified (somehow.. may be HttpSessionBindingEvent?.. not
> sure how yet), and
> then it'll do whatever it needs to do, reset all of the tables, etc...
>
> am I on the right track? ..or smoking crack?
>
> Thanks in advance,
> _Ivan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to