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

Optimize a case in two thread call reconnect method. #2135

Merged
merged 2 commits into from
Jul 26, 2018

Conversation

carryxyh
Copy link
Member

Add reconnection lock to control only one thread can can reconnect method.
This will avoid problem in this case:
Thread A reconnecting, and success, then send msg.
Thread B reconnecting but invoke disconnect. Then the Thread A will send msg fail because of Thread B's disconnecting call.

The issue is here:
#944

…thod.

This will avoid problem in this case:
Thread A reconnecting, and success, then send msg.
Thread B reconnecting but invoke disconnect. Then the Thread A will send msg fail because of Thread B's disconnecting call.
@codecov-io
Copy link

codecov-io commented Jul 25, 2018

Codecov Report

Merging #2135 into master will increase coverage by 0.06%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2135      +/-   ##
============================================
+ Coverage     54.18%   54.25%   +0.06%     
- Complexity     5092     5093       +1     
============================================
  Files           559      559              
  Lines         24935    24955      +20     
  Branches       4442     4459      +17     
============================================
+ Hits          13512    13540      +28     
+ Misses         9386     9379       -7     
+ Partials       2037     2036       -1
Impacted Files Coverage Δ Complexity Δ
...pache/dubbo/remoting/transport/AbstractClient.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java 51.89% <0%> (-3.8%) 10% <0%> (-3%)
...ng/initializer/DubboWebApplicationInitializer.java
...nitializer/DubboApplicationContextInitializer.java 100% <0%> (ø) 2% <0%> (?)
...apache/dubbo/rpc/protocol/dubbo/FutureAdapter.java 64.51% <0%> (+6.45%) 3% <0%> (ø) ⬇️
...apache/dubbo/common/utils/CompatibleTypeUtils.java 72.89% <0%> (+11.78%) 30% <0%> (+1%) ⬆️
...g/spring/initializer/DubboApplicationListener.java 90.9% <0%> (+27.27%) 4% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3eae624...0dd456a. Read the comment docs.

@zonghaishang
Copy link
Member

It looks good to me

@zonghaishang zonghaishang merged commit e90d95c into apache:master Jul 26, 2018
@carryxyh
Copy link
Member Author

There has sth wrong about my describe of this pr.
This is one optimize when two thread call reconnect.

In old way:
Thread A call reconnect.
Thread B call reconnect. This case maybe make twice connect and twice disconnect.

In new way:
Thread A call reconnect, Thread B wait for the lock.
After Thread A finishing reconnect, Thread B will not do connect and disconnect. Because of that Thread A finish connect, this client is connected, it dose not need to reconnect again.

@carryxyh carryxyh changed the title Fix a bug when client reconnect Optimize a case in two thread call reconnect method. Jul 27, 2018
@carryxyh carryxyh deleted the fix/reconnect branch July 27, 2018 08:47
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

Successfully merging this pull request may close these issues.

3 participants