*sigh*
Ideally, we would use the real @GuardedBy annotation instead of just a comment, and then
FindBugs could tell us whenever a guarded field was accessed without the corresponding lock being held.
Until then, we have to rely on lucky breaks and more (and better prepared) eyeballs.
--tim
Joe Walker-3 wrote:
Tim - you scare me! How the *%@£$ did you spot that?
Thanks.
Joe.
On Wed, Apr 9, 2008 at 3:08 PM, tpeierls <tim@peierls.net> wrote:
>
> It wasn't a waste. I found a concurrency bug while looking at it. :-/
>
> The invalidated field is @GuardedBy("invalidLock"), so all access to the
> field must be done with the lock held. The invalidateIfNeeded() method,
> however, tests the field outside of any synchronization.
>
> Quickest fix would be to make the field volatile.