<Swing Dev> <AWT Dev> Review request #4: 6852592 (invalidate() must be smarter) - approved
Artem Ananiev
Artem.Ananiev at Sun.COM
Thu Oct 8 08:34:00 UTC 2009
Anthony Petrov wrote:
> On 10/7/2009 7:05 PM Anthony Petrov wrote:
>> On 10/07/2009 06:57 PM, Artem Ananiev wrote:
>>>> Artem, would you agree on placing all calls to the isValid() under
>>>> the TreeLock?
>>>
>>> Yes, that would be fine. Have we already introduced a warning about all
>>
>> OK, I'll modify the fix for 6887249 accordingly.
>
> Well, I revised the code, and it appears that the 'valid' boolean field
> is declared volatile. Which basically means that we should only acquire
> a lock when we need an atomic "read-then-update" sort of operation (like
> validate() or invalidate() do.) When we need to read the value of this
> field only w/o subsequent updating it, we don't actually need any
> locking at all. So I tend to think that the fix for 6887249 should
> modify the Container.validate() method only. What do you think?
If isValid() were a final method that just returns a value of 'isValid'
field, then yes, we wouldn't have to provide any external
synchronization. However, users might want to override isValid(), so I'd
better place all the calls to isValid() under the tree lock.
Thanks,
Artem
> --
> best regards,
> Anthony
More information about the swing-dev
mailing list