List of usage examples for io.netty.channel ReflectiveChannelFactory ReflectiveChannelFactory
public ReflectiveChannelFactory(Class<? extends T> clazz)
From source file:io.grpc.netty.NettyServerBuilder.java
License:Apache License
/** * Specifies the channel type to use, by default we use {@code EpollServerSocketChannel} if * available, otherwise using {@link NioServerSocketChannel}. * * <p>You either use this or {@link #channelFactory(io.netty.channel.ChannelFactory)} if your * {@link ServerChannel} implementation has no no-args constructor. * * <p>It's an optional parameter. If the user has not provided an Channel type or ChannelFactory * when the channel is built, the builder will use the default one which is static. * * <p>You must also provide corresponding {@link EventLoopGroup} using {@link * #workerEventLoopGroup(EventLoopGroup)} and {@link #bossEventLoopGroup(EventLoopGroup)}. For * example, {@link NioServerSocketChannel} must use {@link * io.netty.channel.nio.NioEventLoopGroup}, otherwise your server won't start. *//*from ww w .j a va2 s . co m*/ public NettyServerBuilder channelType(Class<? extends ServerChannel> channelType) { checkNotNull(channelType, "channelType"); return channelFactory(new ReflectiveChannelFactory<>(channelType)); }
From source file:io.vertx.core.dns.impl.fix.DnsNameResolverBuilder.java
License:Apache License
/** * Sets the {@link ChannelFactory} as a {@link ReflectiveChannelFactory} of this type. * Use as an alternative to {@link #channelFactory(ChannelFactory)}. * * @param channelType the type//from w w w .j a v a 2 s . com * @return {@code this} */ public DnsNameResolverBuilder channelType(Class<? extends DatagramChannel> channelType) { return channelFactory(new ReflectiveChannelFactory<DatagramChannel>(channelType)); }