Well, when I was mentioning the term user session, I was discussing from
a threading/transaction perspective, not from the servlet object
perspective.  It is the worker thread that represents a active user
session and accesses both the session and the servlet object (if we want
to be precise).

Chuck was right.  It is possible to have one client (single browser) to
start two concurrent sessions at the same time, both eligible to access
the same HttpSession object.  Therefore, it looks like synchronization
is necessary from the spec.  However, the spec does not define how
HttpSession should be implemented (it's just an interface).  In fact,
the session attributes were implemented as a Hashtable in tomcat, not a
Hashmap (just double checked the latest 5.5.15 src of tomcat).  As we
all know, Hashtable already has thread sync built in.  So that's why
additional synchronization on HttpSession in tomcat is unnecessary.

ND 

-----Original Message-----
From: GB Developer [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 06, 2006 6:33 PM
To: 'Tomcat Users List'
Subject: RE: Single Thread is deprecated?

> -----Original Message-----
> From: Duan, Nick [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 06, 2006 5:14 PM
> To: Tomcat Users List
> Subject: RE: Single Thread is deprecated?
> 
> Typo due to my laziness.  I knew someone was going to catch 
> this. Actually the sentence should read:  ... because there 
> is only one servlet that is active during a single user session.  
> 
> In other words, there is no way a single user session 
> (represented by a worker thread) can access more than one 
> servlet at a time.

Yah, I don't think that's right either, and besides that, it's a little
backwards to describe it as you have.   A sessions doesn't so much
access
servlets, as the servlets (more than one, regardless of their
single-threadness) can access a single Session at once.

Sessions are (never?) thread-safe. Which is perhaps one reason why
SingleThreadModel was deprecated. People thought by using that interface
that they would never have to worry about synch issues again.   

Even if you have nothing but singleThread servlets, that only prevents
concurrent access to that servlet. Neither singleThread servlets nor any
other mechanism I'm aware of can prevents concurrent access to a single
Session object. 

Perhaps Remy will weigh in again with so many wildly varying 'opinions'
;)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to