Add synchronized block around notifyAll when setting a value