cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@dslextreme.com>
Subject Re: svn commit: r169856 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java
Date Thu, 12 May 2005 23:50:35 GMT
Why is "sessions" a synchronized map if you are only accessing it in a 
block synchronized on the session.  I would much prefer that you
a) not use a synchronized map
b) synchronize on the map instead of the session.

Is there a reason that this wouldn't work?

Ralph

joerg@apache.org wrote:

>Author: joerg
>Date: Thu May 12 10:50:20 2005
>New Revision: 169856
>
>URL: http://svn.apache.org/viewcvs?rev=169856&view=rev
>Log:
>fixed weak referencing (thanks to Alfred Nathaniel)
>
>Modified:
>    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java
>
>Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java
>URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java?rev=169856&r1=169855&r2=169856&view=diff
>==============================================================================
>--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java
(original)
>+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/environment/http/HttpRequest.java
Thu May 12 10:50:20 2005
>@@ -230,11 +230,11 @@
>             // synch on server session assures only one wrapper per session 
>             synchronized (serverSession) {
>                 // retrieve existing wrapper
>-                session = (HttpSession)sessions.get(serverSession);
>+                session = (HttpSession)((WeakReference)sessions.get(serverSession)).get();
>                 if (session == null) {
>                     // create new wrapper
>                     session = new HttpSession(serverSession);
>-                    sessions.put(serverSession, session);
>+                    sessions.put(serverSession, new WeakReference(session));
>                 }
>             }
>         } else {
>
>
>  
>


Mime
View raw message