lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: volatile write to make isCleaning visible at ConcurrentLRUCache
Date Sat, 08 Mar 2014 20:28:08 GMT
On 3/8/2014 12:50 PM, Yonik Seeley wrote:
> On Sat, Mar 8, 2014 at 2:33 PM, Furkan KAMACI <> wrote:
>> ConcurrentLRUCache<K,V>  class has that lines:
>> ...
>> long oldestEntry = this.oldestEntry;
>> isCleaning = true;
>> this.oldestEntry = oldestEntry;     // volatile write to make isCleaning
>> visible
>> ...
>> What does that assignment and so makes isCleaning visible?
> It's called piggy-backing...
> All changes before a volatile write will be visible to another thread
> after reading that volatile variable.

Is there any kind of testing we can put in Lucene or Solr that can
detect if a future version of Java changes in a way that breaks this?

Do we have any idea whether this side effect of volatile access is part
of the Java specification or simply an exploitable side effect of
current implementations?  If it's the latter, perhaps we need to locate
and comment uses like this in a way that can be easily found later.


View raw message