imbajin commented on code in PR #3157:
URL: https://github.com/apache/hugegraph/pull/3157#discussion_r4040895056


##########
hugegraph-pd/hg-pd-client/src/main/java/org/apache/hugegraph/pd/client/AbstractClient.java:
##########
@@ -98,79 +104,154 @@ public static <T extends AbstractStub> T setAsyncParams(T 
stub, PDConfig config)
                                new Authentication(config.getUserName(), 
config.getAuthority()));
     }
 
-    protected AbstractBlockingStub getBlockingStub() throws PDException {
+    protected synchronized AbstractBlockingStub getBlockingStub() throws 
PDException {
         if (proxy.getBlockingStub() == null) {
-            synchronized (this) {
-                if (proxy.getBlockingStub() == null) {
-                    String host = resetStub();
-                    if (host.isEmpty()) {
-                        throw new 
PDException(Pdpb.ErrorType.PD_UNREACHABLE_VALUE,
-                                              "PD unreachable, pd.peers=" + 
config.getServerHost());
-                    }
-                }
+            String host = resetStub(stubResetTimeoutMillis());
+            if (host.isEmpty()) {
+                throw new PDException(Pdpb.ErrorType.PD_UNREACHABLE_VALUE,
+                                      "PD unreachable, pd.peers=" + 
config.getServerHost());
             }
         }
         return setBlockingParams(proxy.getBlockingStub(), config);
     }
 
-    protected AbstractStub getStub() throws PDException {
+    protected synchronized AbstractStub getStub() throws PDException {
         if (proxy.getStub() == null) {
-            synchronized (this) {
-                if (proxy.getStub() == null) {
-                    String host = resetStub();
-                    if (host.isEmpty()) {
-                        throw new 
PDException(Pdpb.ErrorType.PD_UNREACHABLE_VALUE,
-                                              "PD unreachable, pd.peers=" + 
config.getServerHost());
-                    }
-                }
+            String host = resetStub(asyncStubResetTimeoutMillis());
+            if (host.isEmpty()) {
+                throw new PDException(Pdpb.ErrorType.PD_UNREACHABLE_VALUE,
+                                      "PD unreachable, pd.peers=" + 
config.getServerHost());
             }
         }
         return setAsyncParams(proxy.getStub(), config);
     }
 
+    protected synchronized void invalidateAsyncStub() {

Review Comment:
   Removed the unused overload in 3124faebc. Channel-scoped invalidation 
remains the only supported path; targeted tests and the full reactor compile 
pass.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to