yuqi1129 commented on code in PR #8682:
URL: https://github.com/apache/gravitino/pull/8682#discussion_r2384766593
##########
core/src/main/java/org/apache/gravitino/utils/ClientPoolImpl.java:
##########
@@ -131,10 +131,11 @@ public void close() {
}
private C get() throws InterruptedException {
- Preconditions.checkState(!closed, "Cannot get a client from a closed
pool");
while (true) {
+ Preconditions.checkState(!closed, "Cannot get a client from a closed
pool");
if (!clients.isEmpty() || currentSize < poolSize) {
synchronized (this) {
+ Preconditions.checkState(!closed, "Cannot get a client from a closed
pool");
Review Comment:
The value `closed` will only be changed in the method `close`, which is not
protected by the object lock, so what the benefit of checking it again and
again in the synchronized code blocks?
--
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]