Re: [picocontainer-dev] Storing Cached items in HttpSession?

Paul Hammant <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
>
> +1. The Pico should pick up the deps in the session automatically  
> without being stored itself. There's just one thing left: How will  
> you support the lifecycle i.e. how do you know that a component has  
> been started/stopped ... ?

Just committed - http://svn.picocontainer.codehaus.org/changelog/ 
picocontainer/?cs=3822

Take a look at the last test method in StoreCachingTestCase.  It  
simulates what a web framework would do.  For each HttpRequest, the  
Map of keys to instances would be retrieved from the HttpSession and  
set for the thread. If there is nothing there for the HttpSession, it  
must be new and the Cache values will be missing.

There are two things I think need to be done

1) make data private so that anyone else retrieving the map from the  
HttpSession will not be able to access data.

2) worry about whether synchronized needs to be applied.  Browsers  
can issue more that one request for the same session simultaneously.  
There could be contention on populating the map ? Maybe ?

So on the question - "what about startable?"  Yeah needs some  
thought.  StoreCached extends Cached which understands some lifecycle  
stuff. There are a number of ideas that could be coded.

And lastly, I have naming blues for StoreCaching and StoreCached.   
Suggestions anyone ?

- Paul

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.