szetszwo commented on PR #1168:
URL: https://github.com/apache/ratis/pull/1168#issuecomment-2419890203
Suppose we have the following code:
```java
synchronized(server) {
...
final CompletableFuture<Void> future = state.shudown()
f.join()
}
```
- I agree with you that calling `join()` at the end of
`synchronized(server)` block seems useless since it just waits for the `state`
thread to terminate. If anything needs to be synchronized, it should be done
inside the `shutdown()` method. Of course, the `state` thread could be
`synchronized(server)` in its `run()` method. The same synchronization will
happen also in the non-shutdown cases. It there is a bug, the non-shutdown
cases should also have the same bug.
- I could see that calling `join()` at the middle of `synchronized(server)`
may be useful in some cases -- the caller wants to wait of the `state` thread
to complete for some reasons such as getting a final result. However, we are
not doing that in our shutdown code.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]