public class LockSplitShape { protected double x_ = 0.0; protected double y_ = 0.0; protected double width_ = 0.0; protected double height_ = 0.0; protected Object locationLock_ = new Object(); protected Object dimensionLock_ = new Object(); double x() { synchronized (locationLock_) { return x_; } } double y() { synchronized (locationLock_) { return y_; } } double width(){ synchronized (dimensionLock_) { return width_; } } double height(){ synchronized (dimensionLock_) { return height_; } } void adjustLocation() { synchronized (locationLock_) { x_ = longCalculation1(); y_ = longCalculation2(); } } void adjustDimensions() { synchronized (dimensionLock_) { width_ = longCalculation3(); height_ = longCalculation4(); } } }