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

AbstractConnectionFactory新建链接 #277

Open
vinsonJiang opened this issue Feb 17, 2022 · 2 comments
Open

AbstractConnectionFactory新建链接 #277

vinsonJiang opened this issue Feb 17, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@vinsonJiang
Copy link

Your question

多线程创建连接

Your scenes

Bootstrap是单例,AbstractConnectionFactory调用doCreateConnection创建连接,设置connectTimeout参数,不会出现线程问题吗?

@nobodyiam
Copy link
Member

@chuailiwu would you please help to take a look?

@chuailiwu
Copy link
Collaborator

Your question

多线程创建连接

Your scenes

Bootstrap是单例,AbstractConnectionFactory调用doCreateConnection创建连接,设置connectTimeout参数,不会出现线程问题吗?

好问题,调试确认了一下,结论如下:
确实可能会有你说的多个线程并发设置时,这个超时时间可能会混的问题。options为Bootstrap的属性,创建channel 时会公用这个options。
解法:需要在外面加一个锁来解决。

@nobodyiam nobodyiam added the bug Something isn't working label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants