class LockSplitShape { // Incomplete protected double x = 0.0; protected double y = 0.0; protected double width = 0.0; protected double height = 0.0; protected final Object locationLock = new Object(); protected final Object dimensionLock = new Object(); public double getX() { synchronized(locationLock) { return x; } } public double getY() { synchronized(locationLock) { return y; } } public double getWidth() { synchronized(dimensionLock) { return width; } } public double getHeight() { synchronized(dimensionLock) { return height; } } public void adjustLocation() { synchronized(locationLock) { x = longCalculation1(); y = longCalculation2(); } } public void adjustDimension() { synchronized(dimensionLock) { width = longCalculation3(); height = longCalculation4(); } } }