Search in sources :

Example 1 with DynamicDirectory

use of org.apache.dubbo.registry.integration.DynamicDirectory in project dubbo by alibaba.

the class MigrationInvoker method doReSubscribe.

private void doReSubscribe(ClusterInvoker<T> invoker, URL newSubscribeUrl) {
    DynamicDirectory<T> directory = (DynamicDirectory<T>) invoker.getDirectory();
    URL oldSubscribeUrl = directory.getRegisteredConsumerUrl();
    Registry registry = directory.getRegistry();
    registry.unregister(directory.getRegisteredConsumerUrl());
    directory.unSubscribe(RegistryProtocol.toSubscribeUrl(oldSubscribeUrl));
    if (directory.isShouldRegister()) {
        registry.register(directory.getRegisteredConsumerUrl());
        directory.setRegisteredConsumerUrl(newSubscribeUrl);
    }
    directory.buildRouterChain(newSubscribeUrl);
    directory.subscribe(RegistryProtocol.toSubscribeUrl(newSubscribeUrl));
}
Also used : DynamicDirectory(org.apache.dubbo.registry.integration.DynamicDirectory) Registry(org.apache.dubbo.registry.Registry) URL(org.apache.dubbo.common.URL)

Aggregations

URL (org.apache.dubbo.common.URL)1 Registry (org.apache.dubbo.registry.Registry)1 DynamicDirectory (org.apache.dubbo.registry.integration.DynamicDirectory)1