kezhenxu94 commented on code in PR #13353:
URL: https://github.com/apache/skywalking/pull/13353#discussion_r2181462965


##########
oap-server/server-library/library-client/src/main/java/org/apache/skywalking/oap/server/library/client/grpc/GRPCClient.java:
##########
@@ -114,32 +144,51 @@ public void registerChecker(final HealthChecker 
healthChecker) {
         this.enableHealthCheck = true;
     }
 
+    /**
+     * Override the default health check runnable with a custom one.
+     * Must override before calling connect()
+     * This can be used to provide a different health check logic.
+     *
+     * @param healthCheckRunnable The custom health check runnable.
+     * @param initialDelay Initial delay before the first health check.
+     * @param period Period between subsequent health checks.
+     */
+    public void overrideCheckerRunnable(final Runnable healthCheckRunnable, 
final long initialDelay, final long period) {

Review Comment:
   TO make sure this is called before calling connect, what about adding an 
argument in the constructor, with this we can avoid misuse in code level in 
stead of in comment/doc level.
   
   Also, to make this override actually useful, I think we should make it a 
`BiConsumer<ManagedChannel, HealthChecker>`, instead of a `Runnable`, so caller 
can use the channel and healthChecker inside the lambda, like this
   
   
   
   ```java
       GRPCClient c = new GRPCClient("", 1, (channel, healthChecker) -> {
         // use the channel to send request
         // use the healthChecker to mark the healthiness
       });
   
   ```



-- 
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: notifications-unsubscr...@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to