Hi,
Since I've been looking at the cache service recently, I thought I'd add my two-pence
worth...
> Cool stuff. In CachedObject and RefreshableCachedObject, the simple public
> methods probably need to be synchronized, multiple threads could be
> simultaneously accessing and changing some of the fields in these objects.
CachedObject - the only non-trivial method is isStale - and if 2 (or more) threads
were to overlap, the worst I could see is that one thread may see the object as stale
slightly earlier. So I would suggest that this stays as is.
RefreshableCachedObject - the only method here is refresh. I'd assume that we can
rely on the global cache service to not call refresh twice in a row and even if it
did, it would call the underlying refresh synchronously - and add the expires time on
twice - but this would happen if the method was synchronised - better to rely on the
service for this I think. There is also the possibility of a clash with the isStale
method - but the only problem I can see is that the getStale method may return the
wrong status - but I would suggest this method should be made private to avoid any
confusion - no one else seems to use the method. So again I would suggest that this
object is fine as is.
> Also, in TurbineGlobalCacheService.clearCache(), the operations of removing
> or refreshing the objects should be sync'd.
I am sure your aware that the hashtable is synchronised - so all the get/put/remove
ops are sync'd. If all is working correctly (?) then only one cache service should be
running and only one thread calling clearCache - perhaps making the method private
would ensure this - does anyone external call that method - its not part of the
interface. So again I would think no sync'ing changes are needed.
I hope this helps - the basic idea is that you limit the areas that could cause
problems.
Chris
---
"surely it is madness to accept life as it is and not as it could be"
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]