Wait AtomicBoolean value change instead of sleep