chenshouye168 commented on code in PR #4670:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/4670#discussion_r1908342391


##########
service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java:
##########
@@ -195,4 +195,10 @@ public Microservice getBackendMicroservice() {
   public MicroserviceInstance getBackendMicroserviceInstance() {
     return microserviceInstance;
   }
+  public MicroserviceInstance getLatestMicroserviceInstance() {
+    MicroserviceInstance latestInstance = 
serviceCenterClient.getMicroserviceInstance(microserviceInstance.getServiceId(),
+            microserviceInstance.getInstanceId());
+    microserviceInstance.setStatus(latestInstance.getStatus());
+    return latestInstance;
+  }

Review Comment:
   This method is used to externally query the latest instance state, and when 
the warm-up function updates the instance state, only the instance state that 
is STARTING can be updated to UP.



##########
service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java:
##########
@@ -212,4 +231,17 @@ public void addProperty(String key, String value) {
   public boolean enabled() {
     return zookeeperRegistryProperties.isEnabled();
   }
+
+  public ZookeeperInstance getZookeeperInstance(){
+    try {
+      ServiceInstance<ZookeeperInstance> zkInstance = 
dis.queryForInstance(instance.getName(), instance.getId());
+      if (zkInstance != null){
+        return zkInstance.getPayload();
+      }
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+    return null;
+  }

Review Comment:
   This method is used to externally query the latest instance state, and when 
the warm-up function updates the instance state, only the instance state that 
is STARTING can be updated to UP



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