-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-27222 Purge FutureReturnValueIgnored warnings from error prone #4634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,9 @@ | |
|
|
||
| import static org.apache.hadoop.hbase.io.asyncfs.FanOutOneBlockAsyncDFSOutputSaslHelper.createEncryptor; | ||
| import static org.apache.hadoop.hbase.io.asyncfs.FanOutOneBlockAsyncDFSOutputSaslHelper.trySaslNegotiate; | ||
| import static org.apache.hadoop.hbase.util.NettyFutureUtils.addListener; | ||
| import static org.apache.hadoop.hbase.util.NettyFutureUtils.safeClose; | ||
| import static org.apache.hadoop.hbase.util.NettyFutureUtils.safeWriteAndFlush; | ||
| import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_SOCKET_TIMEOUT_KEY; | ||
| import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_USE_DN_HOSTNAME; | ||
| import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_CLIENT_USE_DN_HOSTNAME_DEFAULT; | ||
|
|
@@ -351,7 +354,7 @@ private static void requestWriteBlock(Channel channel, StorageType storageType, | |
| buffer.writeShort(DataTransferProtocol.DATA_TRANSFER_VERSION); | ||
| buffer.writeByte(Op.WRITE_BLOCK.code); | ||
| proto.writeDelimitedTo(new ByteBufOutputStream(buffer)); | ||
| channel.writeAndFlush(buffer); | ||
| safeWriteAndFlush(channel, buffer); | ||
| } | ||
|
|
||
| private static void initialize(Configuration conf, Channel channel, DatanodeInfo dnInfo, | ||
|
|
@@ -360,7 +363,7 @@ private static void initialize(Configuration conf, Channel channel, DatanodeInfo | |
| throws IOException { | ||
| Promise<Void> saslPromise = channel.eventLoop().newPromise(); | ||
| trySaslNegotiate(conf, channel, dnInfo, timeoutMs, client, accessToken, saslPromise); | ||
| saslPromise.addListener(new FutureListener<Void>() { | ||
| addListener(saslPromise, new FutureListener<Void>() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Promoting" the listener makes sense. |
||
|
|
||
| @Override | ||
| public void operationComplete(Future<Void> future) throws Exception { | ||
|
|
@@ -404,7 +407,7 @@ private static List<Future<Channel>> connectToDataNodes(Configuration conf, DFSC | |
| Promise<Channel> promise = eventLoopGroup.next().newPromise(); | ||
| futureList.add(promise); | ||
| String dnAddr = dnInfo.getXferAddr(connectToDnViaHostname); | ||
| new Bootstrap().group(eventLoopGroup).channel(channelClass) | ||
| addListener(new Bootstrap().group(eventLoopGroup).channel(channelClass) | ||
| .option(CONNECT_TIMEOUT_MILLIS, timeoutMs).handler(new ChannelInitializer<Channel>() { | ||
|
|
||
| @Override | ||
|
|
@@ -413,7 +416,7 @@ protected void initChannel(Channel ch) throws Exception { | |
| // channel connected. Leave an empty implementation here because netty does not allow | ||
| // a null handler. | ||
| } | ||
| }).connect(NetUtils.createSocketAddr(dnAddr)).addListener(new ChannelFutureListener() { | ||
| }).connect(NetUtils.createSocketAddr(dnAddr)), new ChannelFutureListener() { | ||
|
|
||
| @Override | ||
| public void operationComplete(ChannelFuture future) throws Exception { | ||
|
|
@@ -533,12 +536,12 @@ private static FanOutOneBlockAsyncDFSOutput createOutput(DistributedFileSystem d | |
| if (!succ) { | ||
| if (futureList != null) { | ||
| for (Future<Channel> f : futureList) { | ||
| f.addListener(new FutureListener<Channel>() { | ||
| addListener(f, new FutureListener<Channel>() { | ||
|
|
||
| @Override | ||
| public void operationComplete(Future<Channel> future) throws Exception { | ||
| if (future.isSuccess()) { | ||
| future.getNow().close(); | ||
| safeClose(future.getNow()); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the approach here where new
NettyFutureUtilsencapsulates the await/cleanup details, (edit: and suppresses warnings in one place, mostly.)