diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java b/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java index 06cb467da..46b2f3df8 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/NamingService.java @@ -138,6 +138,14 @@ public interface NamingService { */ void deregisterInstance(String serviceName, String groupName, String ip, int port, String clusterName) throws NacosException; + /** + * deregister instance with full instance information and default groupName + * @param serviceName + * @param instance + * @throws NacosException + */ + void deregisterInstance(String serviceName, Instance instance) throws NacosException; + /** * deregister instance with full instance information * diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java index d37971441..a6f7fe65d 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingService.java @@ -231,6 +231,11 @@ public class NacosNamingService implements NamingService { deregisterInstance(serviceName, groupName, instance); } + @Override + public void deregisterInstance(String serviceName, Instance instance) throws NacosException { + deregisterInstance(serviceName, Constants.DEFAULT_GROUP, instance); + } + @Override public void deregisterInstance(String serviceName, String groupName, Instance instance) throws NacosException { beatReactor.removeBeatInfo(NamingUtils.getGroupedName(serviceName, groupName), instance.getIp(), instance.getPort());