From 502fa0dcdc7b20f3508893ce07598c458cdf3b4f Mon Sep 17 00:00:00 2001 From: caoyixiong Date: Mon, 24 Jun 2019 10:54:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90issue=E3=80=91=20#1425?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/alibaba/nacos/api/naming/NamingService.java | 8 ++++++++ .../alibaba/nacos/client/naming/NacosNamingService.java | 5 +++++ 2 files changed, 13 insertions(+) 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());