diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java index c11273e..0901d86 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java @@ -928,6 +928,7 @@ public class RpcClientImpl extends AbstractRpcClient { // know where we stand, we have to close the connection. checkIsOpen(); IOException writeException = null; + boolean shouldCallClose = false; synchronized (this.outLock) { if (Thread.interrupted()) throw new InterruptedIOException(); @@ -939,14 +940,16 @@ public class RpcClientImpl extends AbstractRpcClient { } catch (IOException e) { // We set the value inside the synchronized block, this way the next in line // won't even try to write - if (markClosed(e)) { - close(); - } + shouldCallClose = markClosed(e); writeException = e; interrupt(); } } + if (shouldCallClose) { + close(); + } + // We added a call, and may be started the connection close. In both cases, we // need to notify the reader. synchronized (this) {