You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/03/20 16:52:07 UTC
[GitHub] [pulsar] BewareMyPower commented on issue #9993: [QUESTION] Thread safe problem about HandlerState#changeToReadyState
BewareMyPower commented on issue #9993:
URL: https://github.com/apache/pulsar/issues/9993#issuecomment-803407153
Is following implementation better?
```java
private static boolean notClosed(State state) {
return state == State.Uninitialized || state == State.Connecting || state == State.RegisteringSchema;
}
// moves the state to ready if it wasn't closed
protected boolean changeToReadyState() {
return STATE_UPDATER.getAndUpdate(this, state -> (notClosed(state) ? State.Ready : state)) == State.Ready;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org