You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tony Riyanto <to...@atosorigin.com> on 2001/06/20 06:54:01 UTC

help wanted : lock mechanism in JSP/servlet

Hi there,

I want to implement an applicatif lock mechanism.
In my web-site, I have a set of pages that can modify some global informations (let's say for example the list of administrators).
I want to refuse access to these modification pages when somebody is currently modifying this information.

I think of creating a Singleton class that implements a lock variable. But my problem is, how we can prevent the case where a person access to these pages (thus positioning the lock), but forget to get out of these pages properly (for example when he kills the browser).

Has anybody been confronted to this problem ?
Is there any mechanism in JSP/Servlet technology to capture the end of a user session and do some action ?

Thanks in advance for your help,

tony riyanto
tony.riyanto@atosorigin.com


Re: help wanted : lock mechanism in JSP/servlet

Posted by David Winterfeldt <dw...@yahoo.com>.
You set up a listener for a session to end and then do
something.  I did this in Tomcat 3.1, but there was a
bug and if the user just closed the browser the event
didn't occur (if they clicked on my logout action,
then it worked (session.invalidate())).  So I also
made a thread that checked every so often and after a
certain amount of time I removed the lock.

David

--- Tony Riyanto <to...@atosorigin.com> wrote:
> Hi there,
> 
> I want to implement an applicatif lock mechanism.
> In my web-site, I have a set of pages that can
> modify some global informations (let's say for
> example the list of administrators).
> I want to refuse access to these modification pages
> when somebody is currently modifying this
> information.
> 
> I think of creating a Singleton class that
> implements a lock variable. But my problem is, how
> we can prevent the case where a person access to
> these pages (thus positioning the lock), but forget
> to get out of these pages properly (for example when
> he kills the browser).
> 
> Has anybody been confronted to this problem ?
> Is there any mechanism in JSP/Servlet technology to
> capture the end of a user session and do some action
> ?
> 
> Thanks in advance for your help,
> 
> tony riyanto
> tony.riyanto@atosorigin.com
> 
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/