public class EvenBetterShape { |
protected double x_ = 0.0; |
protected double width_ = 0.0; |
protected Object locationLock_ = new Object(); |
protected Object dimensionLock_ = new Object(); |
public double x() { |
synchronized(locationLock_) { |
return x_; |
} |
} |
public double width() { |
synchronized(dimensionLock_) { |
return width_; |
} |
} |
} |