Although Steven gave good suggestions to solve this problem, but I think
what Xizhen
wants is "when the browser closes, then only servlet is allowed to be run
by another user". If I use synchronized to lock some code or use single
threaded model where service method of the servlet cannot be executed
simultaneously by more than 1 thread, *then* issue of removing contention
is controlled by the servlet code *and* not by the browser.

And servlet has no idea by default when the browser closes. I think, one
can force the servlet not to accept simultaneous connections(and I mean
when the browser closes) is to utilize cookies(i.e some form of session
tracking).
On *onUnload* event of the html page, we can force the servlet to be
called(and send some cookie to inform the servlet of this event). After
this, servlet can free some lock(eg semaphore) to give code access to
another user.

-mukul


At 06:59 PM 7/20/99 -0400, you wrote:
>You can have a boolean(or int, if you want a counting
>semaphore) that is set when the servlet is in use..
>
>Tim
>
>--- Xizhen Wang <[EMAIL PROTECTED]> wrote:
>> Hi all!
>>
>> Is it possible to disallow multiple users logging in
>> and running Java
>> Servlets at the same time? I want to disallow access
>> to my Java Servlets
>> if another user has already logged on. Can I use
>> session tracking to
>> prevent this from happening - ie force other users
>> to wait and log in
>> again once the first user has logged out/closed his
>> browser?
>>
>> Thanks!
>> Xizhen

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to