Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于DefaultClient中JConnector.ConnectionWatcher实现上的一些疑惑 #109

Open
tony-is-coding opened this issue Apr 12, 2022 · 1 comment

Comments

@tony-is-coding
Copy link

tony-is-coding commented Apr 12, 2022

个人提出一个在学习 Jupiter 过程中的疑惑
我看到代码中 DefaultClient#watchConnection(Directory ) 这个方法实现内匿名实现了一个 JConnector.ConnectionWatcher; 其中重写的start() 方法用到了一些同步机制让我感到不解:

  1. 为何需要通过这样的线程唤醒来做同步?
  2. 是为了应对什么样的场景呢?

以下是我的个人的一些猜测:

  1. 为了应对一个远程地址同时发布两个服务?
  2. 为了应对远程服务出现了 register -> deregister -> register 这样的操作?

Snipaste_2022-04-12_09-41-27

如果有阅读过代码或者对分布式服务注册发现熟练的大佬能帮忙解惑, 那将感激不尽了

@fengjiachun
Copy link
Owner

意图很简单,订阅服务+建立连接整个过程希望做成纯异步的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants