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));
}
Aggregations