Re: [picocontainer-dev] Storing Cached items in HttpSession?
Paul Hammant <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
>
> I think StoredCached uses a wrong implementation. Basically the
> ObjectReference should be responsible for keeping the object. Like
> in the ThreadCached impl, the StoreCached impl should be only a
> convenience class:
>
> class StoreCached {
> private final Map map = new HashMap();
> StoreCached(final CA delegate) {
> super(delegate, new ObjectRererence() {
> Object get() {
> return map.get(getComponentKey());
> }
> Object put(Object obj) {
> map.gut(getComponentKey(), obj);
> }
> });
> }
> }
Done as you say, but with the anon inner class in StoredCaching (the
factory).
>
> All implemented with anon classes, but I hope you see the point
> (and no need for "protected" members in "Cached").
>
.. protected chg undone.
> BTW: I'd really like to have a references package for all the
> ObjectReference impls (boy, how I miss ObjectReference in the JDK
> itself. Could have used it so often already).
>
Yeah, there are a few, Mosly named inner classes. Will have a look.
>>
>> 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 ?
>
> In the impl above synchronization is the task of the map impl.
>
>> 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.
>
> The impl above inherits the behaviour from Cached.
Now it just uses Cached as is. StoreCached the class has been deleted.
>
>> And lastly, I have naming blues for StoreCaching and StoreCached.
>> Suggestions anyone ?
>
> Above they are more "ExternallyManaged" ;-)
yeah, but is not snappy :-)
- Paul
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email