The question is what do we lock to prevent two threads from (almost
simultaneously) creating the same object. We can lock the object which
is refreshing, to make sure no one touches it while it's refreshing, but
before an object is in the cache, there's nothing to lock. Would it
make sense to lock the whole cache while you build something to put in
there?
-Nissim
Paul O'Leary wrote:
>
> I think Leon's right. I think you need to synchronize the CachedObjects at
> a higher level in general.
>
> Actually - forgive me, I'm new around here - is it just me or does the
> GlobalCacheService have much more general threading issues, as Leon
> suggests?
>
> PaulO.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Leon Messerschmidt
> Sent: Tuesday, August 01, 2000 1:24 PM
> To: Turbine
> Subject: Re: Thread safety of refreshable cache
>
> Hi,
>
> Sounds OK to me. Just on the same note. Shouldn't we synchronize on object
> creation as well, for in case a threads starts to create a new object and
> before
> it finishes a second thread asks for the same object... This will probably
> not
> cause a problem except that the second thread starts the initialization
> process
> from scratch again. This could take a lot of time - which is exactly the
> reason
> we cache objects in the first place.
>
> ~ Leon
>
> > Hi,
> >
> > I'm working on the refreshable cache we talked about last week. I was
> > just thinking that it might not be thread safe if the
> > RefreshableCachedObject was in refresh() while a request thread tried to
> > access the contents. So I think it would be good to synchronize on this
> > in RefreshableCachedObject when it calls contents.refresh().
> >
> > Does that sound like it will work?
> >
> > -Nissim
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]