private void update(State expected, @NotNull State replacement) {
    if (!state.compareAndSet(expected, replacement)) throw new IllegalStateException();
  }
private void update(State expected, @NotNull State replacement)