Craig, I think you probably misunderstood my question. Our application
has a requirement to clear some data stored in a user's session when
an external event occurs. Or more precisely, here's what happens:
#1. An external event occurs (eg weather goes bad);
#2. It notifies one servlet housed in our web servlet application,
and sends along a userID;
#3. This servlet of ours then has to find out if this user is login
to our web server or not;
#4. If yes, then clear the data from his session, so that new data
can be retrieved from database;
With the current servlet API, I just can't seem to be able to do
what I want without some sort of problems.
The servlet engine we used (ServletExec) already supports session
persistence across server restart. This is not an issue. The
issue is to come up with a way to get hold of sessions for a
particular user.
I hope it's clearer of what I want to do. Thanks! --Pinghua
On Monday, Oct-04-1999 13:22 PM (PDT) [EMAIL PROTECTED] (Craig McClanahan)
wrote:
|> Pinghua Young wrote:
|>
|> > We are using ServletExec 2.1 and it does support sessions across server
|> > restart. The problem I have is, I don't have any way to make my hashtable
|> > persistent across server restart. All data in our sessions are
|> > Serializable.
|> >
|> > Without an API method to somehow get a list of active sessions, I can't
|> > seem to be to do what I want, which is very desirable IMHO.
|> >
|>
|> Having an API method to get the list of active sessions will not help you achieve
|your overall goal,
|> without additional support from the servlet engine itself. Consider the
|hypothetical case where you had
|> such a call, and walk though the events that are occurring:
|>
|> * The server is told to restart itself.
|>
|> * You find out about this in some fashion (presumably
|> in the destroy() method of some particular servlet).
|>
|> * You access the list of valid sessions and write out
|> their contents somewhere, using serialization.
|>
|> * The restart is completed. At this point, the servlet
|> engine's internal collection of active sessions has
|> been erased.
|>
|> * Your servlet's init() method is called, and you get
|> ready to load back in the session data from the
|> previously active sessions.
|>
|> * But now what do you do? There's no mechanism
|> to create a session that works inside the init()
|> method, or to create more than a session for the
|> current request in doGet() or doPost().
|>
|> Bottom line: if you want sessions to survive server restarts, your servlet engine
|has to support this
|> functionality itself. Only the servlet engine has the access to its own internal
|data structures
|> necessary to accomplish this. If the servlet engine does support it, there is no
|need for you to access
|> a list of active sessions because it's all taken care of for you transparently.
|>
|> >
|> > --Pinghua
|> >
|>
|> Craig
|>
|> ___________________________________________________________________________
|> 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