meszibalu commented on a change in pull request #4125:
URL: https://github.com/apache/hbase/pull/4125#discussion_r832309350
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
##########
@@ -321,31 +320,39 @@ public void run(boolean cancelled) throws IOException {
} else {
Channel channel = channelRef.get();
if (channel == null) {
- try {
- Channel newChannel = connect();
- if (!channelRef.compareAndSet(null, newChannel)) {
- newChannel.close();
+ connect().addListener(new ChannelFutureListener() {
+ @Override public void operationComplete(ChannelFuture
channelFuture) {
+ Channel ch = channelFuture.channel();
Review comment:
What happens if the future is unsuccessful?
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
##########
@@ -321,31 +320,39 @@ public void run(boolean cancelled) throws IOException {
} else {
Channel channel = channelRef.get();
if (channel == null) {
- try {
- Channel newChannel = connect();
- if (!channelRef.compareAndSet(null, newChannel)) {
- newChannel.close();
+ connect().addListener(new ChannelFutureListener() {
+ @Override public void operationComplete(ChannelFuture
channelFuture) {
+ Channel ch = channelFuture.channel();
+ if (channelFuture.isSuccess()) {
+ if (!channelRef.compareAndSet(null, ch)) {
+ ch.close();
+ ch = channelRef.get();
+ }
+ writeAndFlushToChannel(call, ch);
Review comment:
I would do this:
```
if (channelRef.compareAndSet(null, ch)) {
writeAndFlushToChannel(call, ch);
} else {
ch.close();
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]