This must have been a mistake in previous prints, my version of JCIP 10.6 has this setLocation()
method :
public void setLocation(Point location) {
boolean reachedDestination;
synchronized (this) {
this.location = location;
reachedDestination = location.equals(destination);
}
if (reachedDestination)
dispatcher.notifyAvailable(this);
}
without method level synchronized
.
Synchronization on the getter is needed to ensure it does not return a stale value.