Direct return when the server goes down unnormally.#2185
Direct return when the server goes down unnormally.#2185beiwei30 merged 34 commits intoapache:masterfrom
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.
|
| } | ||
|
|
||
| @Test | ||
| @Ignore |
There was a problem hiding this comment.
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.
It's not a good practice to import *
There was a problem hiding this comment.
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 |
| import org.junit.Before; | ||
| import org.junit.BeforeClass; | ||
| import org.junit.Test; | ||
| import org.junit.*; |
There was a problem hiding this comment.
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.
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.
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