Avoid warning Unknown channel option 'SO_KEEPALIVE'

Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
This commit is contained in:
Max Lambrecht 2020-05-18 12:51:02 -03:00
parent 11d00e191c
commit a58aa9925b
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package spiffe.workloadapi.internal;
import io.grpc.ManagedChannel; import io.grpc.ManagedChannel;
import io.grpc.netty.NegotiationType; import io.grpc.netty.NegotiationType;
import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyChannelBuilder;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup; import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollDomainSocketChannel; import io.netty.channel.epoll.EpollDomainSocketChannel;
import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.epoll.EpollEventLoopGroup;
@ -58,6 +59,8 @@ public class GrpcManagedChannelFactory {
// nThreads = 0 -> use Netty default // nThreads = 0 -> use Netty default
EpollEventLoopGroup epollEventLoopGroup = new EpollEventLoopGroup(0, executorService); EpollEventLoopGroup epollEventLoopGroup = new EpollEventLoopGroup(0, executorService);
channelBuilder.eventLoopGroup(epollEventLoopGroup) channelBuilder.eventLoopGroup(epollEventLoopGroup)
// avoid warning Unknown channel option 'SO_KEEPALIVE'
.withOption(ChannelOption.SO_KEEPALIVE, null)
.channelType(EpollDomainSocketChannel.class); .channelType(EpollDomainSocketChannel.class);
return epollEventLoopGroup; return epollEventLoopGroup;
} }