>From what you've posted there is no obvious thread problem that I can
see. Do you have a public site where we can look at the servlet code?
What are the member variables of the servlet?
You claim the SessionManager runs as a separate thread. How? Where is it
started? How is it accessed?
And purely out of curiosity: Why did you find it necessary to implement
a SessionManager?
Kevin Mukhar
Susie Itzkowitz wrote:
>
> We are not using a class variable like you have mentioned. However, we are
> using
> a SessionManager which runs as a seperate thread & is in charge of adding,
> deleting & retrieving sessions.
>
> Can there be a problem with the SessionManager thread & the servlet thread
> accessing the session in the following code?
>
> This is the code which creates the collection to store the sessions
> public PCTSSessionManager(long timeOut) {
> d_Sessions = Collections.synchronizedMap(new HashMap());
> }
>
> This is the code that retrieves a session for the servlet thread
> public PCTSSession getSession(String userId) {
> PCTSSession rv = (PCTSSession)d_Sessions.get(userId);
> if (rv != null) {
> validateSession(rv);
> if (rv.isValidSession()) {
> rv.touch();
> }
> }
> return rv;
> }
>
> This is the code that adds a session to the collection maintained by the
> SessionManager
> public void addSession(PCTSSession se) {
> // this would kill another session if the user is already there.
> synchronized(d_Sessions) {
> d_Sessions.put(se.getUserId(),se);
> }
> }
>
> S Itzkowitz
> [EMAIL PROTECTED]
___________________________________________________________________________
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