We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
DefaultRegistryServer#handlePublish(...)方法中提到putIfAbsent和config.newVersion()需要是原子操作, 所以需要加锁。按照我的理解,if (config.getConfig().putIfAbsent(meta.getAddress(), meta) == null) 这一步已经是原子操作了,相应地保证了 config.newVersion() 不会被执行多次,是不是这里不需要加锁呢?
Describe your use scenes (why need this feature)
Describe the advice or solution you'd like
java -version
uname -a
The text was updated successfully, but these errors were encountered:
你好,看了下,代码有点久远不太想的起来当时的意图,不过你说的应该是对的,不需要加锁 可能有一点影响: version 是 config 粒度的,会导致 version 和原来的行为有差别
Sorry, something went wrong.
因为目前只看了代码库中注册中心部分,RPC还没来得及看,理解得可能比较片面。感谢解答。
No branches or pull requests
Your question
DefaultRegistryServer#handlePublish(...)方法中提到putIfAbsent和config.newVersion()需要是原子操作, 所以需要加锁。按照我的理解,if (config.getConfig().putIfAbsent(meta.getAddress(), meta) == null) 这一步已经是原子操作了,相应地保证了 config.newVersion() 不会被执行多次,是不是这里不需要加锁呢?
Your scenes
Describe your use scenes (why need this feature)
Your advice
Describe the advice or solution you'd like
Environment
java -version
): java 8uname -a
): WindowsThe text was updated successfully, but these errors were encountered: