meszibalu commented on a change in pull request #4125:
URL: https://github.com/apache/hbase/pull/4125#discussion_r836464914
##########
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:
> That method begins with a null check for exactly the same reason.
Where? Are talking about line 327? Because that `null` check does not
matter. We are talking about race conditions and `Atomic*` in java does not use
any locking.
--
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]