> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] Behalf Of Joerg Heinicke
> Sent: Dienstag, 10. Mai 2005 18:56
> To: [email protected]
> Subject: [IMP] synchronization on session object in Cocoon
 
> As you can see on every request a new wrapper is instantiated 
> which is really
> bad. It is not possible to synchronize on Cocoon session 
> objects. What we
> probably need is a Map mapping the server sessions to the 
> wrapper objects.
> 
> WDYT?
> 
> Joerg

-1

Servlet API [1] says "Session information is scoped only to the current web 
application (ServletContext), so information stored in one context will not be 
directly visible in another."  I read that as "A new session object must be 
create for requests in different contexts and may be create for requests in the 
same context."

So the circumstances under which synchronized(session) works is dependent on 
the servlet implementation.

But the String pool comes to the rescue.  This should work for all sessions 
within the same JVM:

   synchronized(session.getId().intern()) {
      ...
   }

Cheers, Alfred.

[1]: 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/servletapi/javax/servlet/http/HttpSession.html
 
 
This message is for the named person's use only. It may contain confidential, 
proprietary or legally privileged information. No confidentiality or privilege 
is waived or lost by any mistransmission. If you receive this message in error, 
please notify the sender urgently and then immediately delete the message and 
any copies of it from your system. Please also immediately destroy any 
hardcopies of the message. You must not, directly or indirectly, use, disclose, 
distribute, print, or copy any part of this message if you are not the intended 
recipient. The sender's company reserves the right to monitor all e-mail 
communications through their networks. Any views expressed in this message are 
those of the individual sender, except where the message states otherwise and 
the sender is authorised to state them to be the views of the sender's company.

Reply via email to