cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathaniel Alfred" <Alfred.Nathan...@swx.com>
Subject RE: [IMP] synchronization on session object in Cocoon
Date Fri, 13 May 2005 06:06:35 GMT
You are proposing to pollute the container session with a parasitic
attribute.  Even if the Serialable issue of that wrapper object was
solved, that is still a -1 for me.  Let's keep the session clean!

Cheers, Alfred.

> -----Original Message-----
> From: Ralph Goers [mailto:Ralph.Goers@dslextreme.com]
> Sent: Donnerstag, 12. Mai 2005 18:27
> To: dev@cocoon.apache.org
> Subject: Re: [IMP] synchronization on session object in Cocoon
> 
> 
> In addition, I really don't like the implementation that was checked 
> in.  Frankly, this is a case where I would look into leveraging 
> backport-util-concurrent 
> (http://www.mathcs.emory.edu/dcl/util/backport-util-concurrent
> /) if that 
> code can be made to work in JDK 1.3.
> 
> What I would look to do is to add the wrapper to a Map using 
> the session 
> id as the key, and then add an attribute to the session that is an 
> instance of a class that implements SessionBindingListener. Then when 
> the sessionDestroyed method is called the wrapper can be removed from 
> the Map.
> 
> Thus the Map would be the object being synchronized, such as
> String id = serverSession.getId();
> syncronized(map) {
>     if (!map.contains(id)) {
>         return (Session)map.get(id);
>     }
>     else {
>         Session session = new HttpSession(serverSession);
>         map.put(id, session);
>         return session;
>     }
> }
> 
> Nathaniel Alfred wrote:
> 
> >>I have an implementation with map in HttpRequest and without 
> >>"double-checked
> >>locking idiom". Shall I commit it?
> >>
> >>Joerg
> >>    
> >>
> >
> >I think there is a memory leak in 
> http://svn.apache.org/viewcvs?rev=169806&view=rev.
> >There is a strong reference session.wrappedSession from 
> value to key in
> >
> >                    // create new wrapper
> >                    session = new HttpSession(serverSession);
> >                    sessions.put(serverSession, session);
> >
> >which causes the WeakHashMap to keep the entries forever.
> >
> >See the Implementation Note in 
> http://java.sun.com/j2se/1.4.2/docs/api/java/util/WeakHashMap.html.
> >
> >Cheers, Alfred.
> >  
> >
> 
>
 
 
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.

Mime
View raw message