io.netty.channel.kqueue.KQueueDatagramChannel Java Examples
The following examples show how to use
io.netty.channel.kqueue.KQueueDatagramChannel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultLoopKQueue.java From reactor-netty with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public <CHANNEL extends Channel> CHANNEL getChannel(Class<CHANNEL> channelClass) { if (channelClass.equals(SocketChannel.class)) { return (CHANNEL) new KQueueSocketChannel(); } if (channelClass.equals(ServerSocketChannel.class)) { return (CHANNEL) new KQueueServerSocketChannel(); } if (channelClass.equals(DatagramChannel.class)) { return (CHANNEL) new KQueueDatagramChannel(); } if (channelClass.equals(DomainSocketChannel.class)) { return (CHANNEL) new KQueueDomainSocketChannel(); } if (channelClass.equals(ServerDomainSocketChannel.class)) { return (CHANNEL) new KQueueServerDomainSocketChannel(); } throw new IllegalArgumentException("Unsupported channel type: " + channelClass.getSimpleName()); }
Example #2
Source File: BuilderUtils.java From servicetalk with Apache License 2.0 | 5 votes |
/** * Returns the correct {@link Class} to use with the given {@link EventLoopGroup}. * * @param group the {@link EventLoopGroup} for which the class is needed * @return the class that should be used for bootstrapping */ public static Class<? extends DatagramChannel> datagramChannel(EventLoopGroup group) { if (useEpoll(group)) { return EpollDatagramChannel.class; } else if (useKQueue(group)) { return KQueueDatagramChannel.class; } else { return NioDatagramChannel.class; } }
Example #3
Source File: DefaultLoopKQueue.java From reactor-netty with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public <CHANNEL extends Channel> Class<? extends CHANNEL> getChannelClass(Class<CHANNEL> channelClass) { if (channelClass.equals(SocketChannel.class)) { return (Class<? extends CHANNEL>) KQueueSocketChannel.class; } if (channelClass.equals(ServerSocketChannel.class)) { return (Class<? extends CHANNEL>) KQueueServerSocketChannel.class; } if (channelClass.equals(DatagramChannel.class)) { return (Class<? extends CHANNEL>) KQueueDatagramChannel.class; } throw new IllegalArgumentException("Unsupported channel type: " + channelClass.getSimpleName()); }
Example #4
Source File: MasterSlaveConnectionManager.java From redisson with Apache License 2.0 | 4 votes |
protected MasterSlaveConnectionManager(Config cfg, UUID id) { this.id = id.toString(); Version.logVersion(); if (cfg.getTransportMode() == TransportMode.EPOLL) { if (cfg.getEventLoopGroup() == null) { this.group = new EpollEventLoopGroup(cfg.getNettyThreads(), new DefaultThreadFactory("redisson-netty")); } else { this.group = cfg.getEventLoopGroup(); } this.socketChannelClass = EpollSocketChannel.class; if (PlatformDependent.isAndroid()) { this.resolverGroup = DefaultAddressResolverGroup.INSTANCE; } else { this.resolverGroup = cfg.getAddressResolverGroupFactory().create(EpollDatagramChannel.class, DnsServerAddressStreamProviders.platformDefault()); } } else if (cfg.getTransportMode() == TransportMode.KQUEUE) { if (cfg.getEventLoopGroup() == null) { this.group = new KQueueEventLoopGroup(cfg.getNettyThreads(), new DefaultThreadFactory("redisson-netty")); } else { this.group = cfg.getEventLoopGroup(); } this.socketChannelClass = KQueueSocketChannel.class; if (PlatformDependent.isAndroid()) { this.resolverGroup = DefaultAddressResolverGroup.INSTANCE; } else { this.resolverGroup = cfg.getAddressResolverGroupFactory().create(KQueueDatagramChannel.class, DnsServerAddressStreamProviders.platformDefault()); } } else { if (cfg.getEventLoopGroup() == null) { this.group = new NioEventLoopGroup(cfg.getNettyThreads(), new DefaultThreadFactory("redisson-netty")); } else { this.group = cfg.getEventLoopGroup(); } this.socketChannelClass = NioSocketChannel.class; if (PlatformDependent.isAndroid()) { this.resolverGroup = DefaultAddressResolverGroup.INSTANCE; } else { this.resolverGroup = cfg.getAddressResolverGroupFactory().create(NioDatagramChannel.class, DnsServerAddressStreamProviders.platformDefault()); } } if (cfg.getExecutor() == null) { int threads = Runtime.getRuntime().availableProcessors() * 2; if (cfg.getThreads() != 0) { threads = cfg.getThreads(); } executor = Executors.newFixedThreadPool(threads, new DefaultThreadFactory("redisson")); } else { executor = cfg.getExecutor(); } this.cfg = cfg; this.codec = cfg.getCodec(); this.commandExecutor = new CommandSyncService(this); }