-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
Direct return when the server goes down unnormally. #2185
Conversation
@carryxyh please check the travis ci failure. |
@diecui1202 |
@diecui1202 |
Codecov Report
@@ Coverage Diff @@
## master #2185 +/- ##
============================================
+ Coverage 54.32% 54.55% +0.23%
- Complexity 5112 5152 +40
============================================
Files 559 570 +11
Lines 24996 25057 +61
Branches 4456 4459 +3
============================================
+ Hits 13578 13671 +93
+ Misses 9386 9345 -41
- Partials 2032 2041 +9
Continue to review full report at Codecov.
|
@@ -117,6 +117,7 @@ public void test_NoInvokers() throws Exception { | |||
} | |||
|
|||
@Test | |||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ignore this test case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't ignore this.
Maybe it is a outdated content ?
import org.junit.Before; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.junit.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a good practice to import *
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, fix it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import * can't pass check-style when submitting a PR
|
||
private Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); | ||
private ProxyFactory proxy = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); | ||
|
||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is an ignore too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix it soon :)
import org.junit.Before; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.junit.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import * can't pass check-style when submitting a PR
@kimmking |
I am not sure if Channel keeps the status of requests ( Maybe keep the status of requests on DefaultFuture can be better? |
I agree with Li Jun’s point of view.
The current elegant downtime work is relatively good. |
|
When the server goes down un-normally, return the unfinished requests directly. The current way is to wait until timeout.
* | ||
* @param channel | ||
*/ | ||
public static void closeChannel(Channel channel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we may possibly avoid introducing UNFINISHED_REQUESTS
by doing this:
for (long id : CHANNELS.keySet()) {
if (channel.equals(CHANNELS.get(id))) {
DefaultFuture future = getFuture(id);
if (!future.isDone()) {
Response disconnectResponse = new Response(r.getId());
disconnectResponse.setStatus(Response.CHANNEL_INACTIVE);
disconnectResponse.setErrorMessage("Channel " + channel + " is inactive. Directly return the unFinished request.");
DefaultFuture.received(channel, disconnectResponse);
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I’ll fix it soon.
* Keep the unfinished request in every channel. When the server goes down un-normally, return the unfinished requests directly. The current way is to wait until timeout. * default method * direct return unfinished requests when remote inactive or disconnect * direct return unfinished requests when remote inactive or disconnect * name and doc * name and doc * fix unit test * fix unit test * fix unit test * close heartbeat to fix unit test * sth test * sth test * sth test * sth test * close when client close * fix unit test * fix unit test * fix unit test * ignore remote invoke unit test * don't clear request when channelInactive * replace import * * remove unuse import * optimize * optimize * fix ci failed * fix ci failed * fix ci failed * fix ci failed * fix ci failed * fix ci failed * fix ci failed * optimize unfinished request keeper * rebase onto master * fix review code (cherry picked from commit c6fd684)
Keep the unfinished request in every channel.
When the server goes down un-normally, return the unfinished requests directly.
The current way is to wait until timeout.
issue:
#2184