HBASE-12951 TestHCM.testConnectionClose is flakey when using AsyncRpcClient as client implementation

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
zhangduo 2015-02-02 11:46:22 +08:00 committed by stack
parent a69e1b6733
commit b8626afc88
1 changed files with 8 additions and 1 deletions

View File

@ -108,7 +108,7 @@ public class AsyncRpcChannel {
private Token<? extends TokenIdentifier> token;
private String serverPrincipal;
boolean shouldCloseConnection = false;
volatile boolean shouldCloseConnection = false;
private IOException closeException;
private Timeout cleanupTimer;
@ -313,6 +313,13 @@ public class AsyncRpcChannel {
calls.put(call.id, call);
// check again, see https://issues.apache.org/jira/browse/HBASE-12951
if (shouldCloseConnection) {
Promise<Message> promise = channel.eventLoop().newPromise();
promise.setFailure(new ConnectException());
return promise;
}
// Add timeout for cleanup if none is present
if (cleanupTimer == null) {
cleanupTimer = AsyncRpcClient.WHEEL_TIMER.newTimeout(timeoutTask, call.getRpcTimeout(),