keepConcentration commented on code in PR #8682:
URL: https://github.com/apache/gravitino/pull/8682#discussion_r2396374332


##########
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:
   @justinmclean
   Thank you for pointing this out. I realize now that my understanding of 
`Preconditions` was insufficient. I'll refactor this to use explicit condition 
checks instead.
   
   @yuqi1129
   You're absolutely right, and I appreciate you catching this. I didn't fully 
consider that since `closed` is not protected by the object lock, the redundant 
check inside the synchronized block is unnecessary. I'll remove the redundant 
checks.



-- 
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]

Reply via email to