You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "yinghuzhu (GitHub)" <gi...@apache.org> on 2019/01/11 10:59:10 UTC

[GitHub] [incubator-dubbo] yinghuzhu commented on issue #3203: 服务发布的时候,怎么提前摘掉一个节点的服务

I wrote a api in the dubbo-admin to disable all of the service in the host. the code like this:

`
    @Autowired
    private ProviderService providerService;
    @Autowired
    private Tool tool;


     //disable services
       List<Provider> providers ;
        try {
            providers = providerService.findByAddress(address);
        }
        catch (Exception e){
            logger.error(e.getMessage()+": "+address, e);
            return false;
        }
        if (!CollectionUtils.isEmpty(providers)) {
            try {
                for (Provider provider : providers) {
                    if (tool.isProviderEnabled(provider)) {
                        providerService.disableProvider(provider.getId());
                    }
                }
            }
            catch (Exception e){
                logger.error(e.getMessage()+": "+address, e);
                return false
            }
        }
`

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3203 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org