Fix potential NPEin Netty4Transport.stopInternal (#56080) (#56129)

Closes #56068
This commit is contained in:
Armin Braun 2020-05-04 19:38:21 +02:00 committed by GitHub
parent b816ab0c18
commit 75d4a4def4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,15 +307,14 @@ public class Netty4Transport extends TcpTransport {
@SuppressForbidden(reason = "debug")
protected void stopInternal() {
Releasables.close(() -> {
if (eventLoopGroup != null) {
Future<?> shutdownFuture = eventLoopGroup.shutdownGracefully(0, 5, TimeUnit.SECONDS);
shutdownFuture.awaitUninterruptibly();
if (shutdownFuture.isSuccess() == false) {
logger.warn("Error closing netty event loop group", shutdownFuture.cause());
}
serverBootstraps.clear();
clientBootstrap = null;
});
}
}, serverBootstraps::clear, () -> clientBootstrap = null);
}
protected class ClientChannelInitializer extends ChannelInitializer<Channel> {