Search in sources :

Example 1 with SkipFailbackWrapperException

use of org.apache.dubbo.registry.support.SkipFailbackWrapperException in project dubbo by alibaba.

the class RegistryProtocol method doReExport.

private <T> void doReExport(final Invoker<T> originInvoker, ExporterChangeableWrapper<T> exporter, URL registryUrl, URL oldProviderUrl, URL newProviderUrl) {
    if (getProviderUrl(originInvoker).getParameter(REGISTER_KEY, true)) {
        Registry registry = null;
        try {
            registry = getRegistry(originInvoker);
        } catch (Exception e) {
            throw new SkipFailbackWrapperException(e);
        }
        LOGGER.info("Try to unregister old url: " + oldProviderUrl);
        registry.reExportUnregister(oldProviderUrl);
        LOGGER.info("Try to register new url: " + newProviderUrl);
        registry.reExportRegister(newProviderUrl);
    }
    try {
        ProviderModel.RegisterStatedURL statedUrl = getStatedUrl(registryUrl, newProviderUrl);
        statedUrl.setProviderUrl(newProviderUrl);
        exporter.setRegisterUrl(newProviderUrl);
    } catch (Exception e) {
        throw new SkipFailbackWrapperException(e);
    }
}
Also used : Registry(org.apache.dubbo.registry.Registry) RpcException(org.apache.dubbo.rpc.RpcException) SkipFailbackWrapperException(org.apache.dubbo.registry.support.SkipFailbackWrapperException) SkipFailbackWrapperException(org.apache.dubbo.registry.support.SkipFailbackWrapperException) ProviderModel(org.apache.dubbo.rpc.model.ProviderModel)

Aggregations

Registry (org.apache.dubbo.registry.Registry)1 SkipFailbackWrapperException (org.apache.dubbo.registry.support.SkipFailbackWrapperException)1 RpcException (org.apache.dubbo.rpc.RpcException)1 ProviderModel (org.apache.dubbo.rpc.model.ProviderModel)1