Maybe like this?

```java
for (;;) {
    int oldState = state.get();
    if (oldState >= ST_SHUTTING_DOWN || state.compareAndSet(oldState, ST_SHUTTING_DOWN)) {
        break;
    }
}
```