yuqi1129 commented on code in PR #8547:
URL: https://github.com/apache/gravitino/pull/8547#discussion_r2354487604


##########
core/src/main/java/org/apache/gravitino/utils/ClientPoolImpl.java:
##########
@@ -55,14 +55,24 @@ public <R> R run(Action<R, C, E> action) throws E, 
InterruptedException {
   @Override
   public <R> R run(Action<R, C, E> action, boolean retry) throws E, 
InterruptedException {
     C client = get();
+    boolean shouldRelease = true;
     try {
       return action.run(client);
 
     } catch (Exception exc) {
       if (retry && isConnectionException(exc)) {
         try {
           client = reconnect(client);
-        } catch (Exception ignored) {
+        } catch (Exception reconnectException) {
+          shouldRelease = false;
+          synchronized (this) {
+            close(client);
+            currentSize -= 1;
+          }
+          synchronized (signal) {

Review Comment:
   Why do we call `signal.notifyAll();`? Only when we successfully release a 
client to the pool will we notify all blocked  thread(see get())



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