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

Subscriber、Watcher重复的进行intern操作 #307

Open
dbl-x opened this issue Mar 15, 2023 · 0 comments
Open

Subscriber、Watcher重复的进行intern操作 #307

dbl-x opened this issue Mar 15, 2023 · 0 comments

Comments

@dbl-x
Copy link

dbl-x commented Mar 15, 2023

Your question

image
image

如上,Watcher对象在添加到Store之前会做一次internWatcher,而internWatcher操作实际是重复做了一次Watcher属性的Set操作。

image
而在网络请求进来,进行从ConfiguratorRegister对象转换为Watcher对象时已经经过了一次Watcher各个属性的set操作,set时已经执行了intern,所以在add到Store之前不需要再次进行intern。(Subscriber同理)

describe your question clearly

Your scenes

describe your use scenes (why need this feature)

Your advice

  1. 简单的解决办法是把Subscriber、Watcher的intern方法移除(Publisher因为有节点间的同步操作,少了Converter这里的操作,暂时还无法移除)
  2. 长期更好的设计模式是在网络的解码器(Netty Decoder)这里对重复的String做必要的intern操作,这样可以在一个地方收敛intern,而不是把intern放到模型对象的set方法中(但SOFARegister网络层直接依赖了Bolt,要支持这个操作需要对网络层做一些重构)

Environment

  • SOFARegistry version: 6.1.9
  • JVM version (e.g. java -version):
  • OS version (e.g. uname -a):
  • Maven version:
  • IDE version:
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

1 participant