Andreas L Delmelle wrote:

Hi Andreas,

<snip/>

Just looked closer, and I may have found a slightly better way of dealing with it.

Since the cause of the problem is CacheCleaners interfering with rehash(), maybe the below patch is a better approach. Once rehash() has been entered, and has acquired the lock on the first segment, set a flag. A CacheCleaner will then only be launched if there is no rehash in progress.

Your patch has been running all day in my tests and I haven't seen the NPE, so it looks good. Before I commit it I have one question: how does this mechanism avoid CacheCleaner threads clearing the ref attribute if they are already running when the rehash method is called. Having the flag in rehash is a bit like a one way sync lock. I would have thought it would be safer for cache cleaner threads and the rehash method to synchronize on a common object so that neither interferes with each other.

WDYT?

Thanks,

Chris


Reply via email to