HBASE-12951 TestHCM.testConnectionClose is flakey when using AsyncRpcClient as client implementation
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
86b8b8da00
commit
fef78acf65
|
@ -108,7 +108,7 @@ public class AsyncRpcChannel {
|
||||||
private Token<? extends TokenIdentifier> token;
|
private Token<? extends TokenIdentifier> token;
|
||||||
private String serverPrincipal;
|
private String serverPrincipal;
|
||||||
|
|
||||||
boolean shouldCloseConnection = false;
|
volatile boolean shouldCloseConnection = false;
|
||||||
private IOException closeException;
|
private IOException closeException;
|
||||||
|
|
||||||
private Timeout cleanupTimer;
|
private Timeout cleanupTimer;
|
||||||
|
@ -313,6 +313,13 @@ public class AsyncRpcChannel {
|
||||||
|
|
||||||
calls.put(call.id, call);
|
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
|
// Add timeout for cleanup if none is present
|
||||||
if (cleanupTimer == null) {
|
if (cleanupTimer == null) {
|
||||||
cleanupTimer = AsyncRpcClient.WHEEL_TIMER.newTimeout(timeoutTask, call.getRpcTimeout(),
|
cleanupTimer = AsyncRpcClient.WHEEL_TIMER.newTimeout(timeoutTask, call.getRpcTimeout(),
|
||||||
|
|
Loading…
Reference in New Issue