pinxiong opened a new issue #8182: URL: https://github.com/apache/dubbo/issues/8182
- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate. - [x] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate. ### Environment * Dubbo version: 3.0 * Operating System version: Mac OS * Java version: 1.8 ### Steps to reproduce this issue The `invokers` should be visible to all threads, because `RouterChain` is singleton and [RouterChain#setInvokers](https://github.com/apache/dubbo/blob/3.0/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java#L200) will be called by [RegistryDirectory#refreshInvoker](https://github.com/apache/dubbo/blob/3.0/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java#L186) when providers have changes. ```java public class RouterChain<T> { public static final Logger LOGGER = LoggerFactory.getLogger(RouterChain.class); // full list of addresses from registry, classified by method name. private List<Invoker<T>> invokers = Collections.emptyList(); // containing all routers, reconstruct every time 'route://' urls change. private volatile List<Router> routers = Collections.emptyList(); ...... public void setInvokers(List<Invoker<T>> invokers) { this.invokers = (invokers == null ? Collections.emptyList() : invokers); stateRouters.forEach(router -> router.notify(this.invokers)); routers.forEach(router -> router.notify(this.invokers)); loop(true); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
