cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [IMP] synchronization on session object in Cocoon
Date Thu, 12 May 2005 07:49:42 GMT
Nathaniel Alfred wrote:

>>-----Original Message-----
>>From: Sylvain Wallez [mailto:sylvain@apache.org]
>>Sent: Mittwoch, 11. Mai 2005 18:04
>>To: dev@cocoon.apache.org
>>Subject: Re: [IMP] synchronization on session object in Cocoon
>>
>>
>>Joerg Heinicke wrote:
>>    
>>
>>>Sylvain Wallez <sylvain <at> apache.org> writes:
>>>      
>>>
>>>>Or more simply we could store the wrapper in the session itself using an attribute.
That way it would be guaranteed to be created only once.
>>>>        
>>>>
>>>Yes, that's another possibility I also had in mind. But on the one hand this smells
a bit (storing a wrapper in the object that the wrapper wraps), on the other hand you can
not restrict access to it, so it can be manipulated from somewhere else. But the Map solution
can indeed be very resource consuming and a bottle neck.
>>>      
>>>
>
>I am having second thoughts about the proposed solution.  If the Cocoon session is stored
as parasitic session attribute, the container can no longer serialize it for persistance or
cluster replication.  Not that one really needs to save/restore this particular attribute
but it will cause nasty log messages at the very least.
>  
>

Good point. A solution can be to for the wrapper to implement 
HttpSessionActivationListener and Serializable, and keep the session it 
wraps as a transient attribute (to avoid its serialization), and restore 
it on session activation (the HttpSessionEvent contains the session).

>I think now that a private WeakHashMap (to leave session timeout to the container) should
be the preferred solution.
>  
>

That's a solution that avoids the parasitic attribute. Where should this 
Map be stored? As a static field of HttpSession?

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message