You may be able to take advantage of the HttpSessionBindingListener
interface. If you put something in the Session that implements that
interface, when the session is invalidated, either due to calling
invalidate() or when the session times out, you will be notified and can
remove the object from the Vector. You may want to set your Session timeout
to something smaller than the default 30 minutes.
(*Chris*)
----- Original Message -----
From: Kalyan_Sangam <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 16, 1999 1:34 AM
Subject: FW: how to restrict multiple login???
> Hi all,
>
> I am having a problem here.I have a set of AgentID and Password which is
> stored in a database.
> I don't want more than one person to login to my system with the same ID
and
> Password.
> How do I achieve this??
>
> In the init() method of my servlet I create a vector object.Whenever the
> Agent logs in I check in the vector whether that agent id is there or not.
> If it is not there then I put the Id into the vector ELSE I give a message
> Agent already logged in.
> When the agent logs off from my system I invalidate the session and remove
> the AgentID from the vector.
> This works fine if he uses the logoff option of my system BUT when the
user
> closes his browser the AgentID still remains in the vector and if he logs
in
> again it says "Agent already logged in" though he is not.
>
> How do I handle this event(closing of browser)???
> I want to remove the Agent Id from the vector when the user closes his
> browser.
>
> Also when the user closes his browser the session is destroyed on the
client
> side but it still exists on the server.
> So I am unable to determine whether the user has closed the browser or
not.
>
> Please enlighten me !!!!
>
> Kalyan Sangam
>
>
___________________________________________________________________________
> 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
>
___________________________________________________________________________
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