[ISSUE #3576] [Enhancement] Adding the destroy lifecycle method on NamingMaintainService (#3985)

This commit is contained in:
JackSun-Developer 2020-10-14 10:17:06 +08:00 committed by GitHub
parent b6bc4bb12f
commit 7527d76743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -167,4 +167,10 @@ public interface NamingMaintainService {
*/
void updateService(Service service, AbstractSelector selector) throws NacosException;
/**
* Shutdown the resource service.
*
* @throws NacosException exception.
*/
void shutDown() throws NacosException;
}

View File

@ -173,4 +173,8 @@ public class NacosNamingMaintainService implements NamingMaintainService {
serverProxy.updateService(service, selector);
}
@Override
public void shutDown() throws NacosException {
serverProxy.shutdown();
}
}

View File

@ -29,6 +29,7 @@ import com.alibaba.nacos.api.selector.ExpressionSelector;
import com.alibaba.nacos.api.selector.NoneSelector;
import com.alibaba.nacos.sys.utils.ApplicationUtils;
import com.alibaba.nacos.test.BaseTest;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -163,5 +164,10 @@ public class NamingMaintainService_ITCase extends BaseTest {
Assert.assertTrue(namingMaintainService.deleteService(serviceName));
}
@After
public void tearDown() throws NacosException {
namingMaintainService.shutDown();
namingService.shutDown();
}
}