Java 类io.netty.channel.kqueue.KQueueEventLoopGroup 实例源码

项目:qpid-jms    文件:NettyTcpTransportTest.java   
private void assertKQueue(String message, boolean expected, Transport transport) throws Exception {
    Field group = null;
    Class<?> transportType = transport.getClass();

    while (transportType != null && group == null) {
        try {
            group = transportType.getDeclaredField("group");
        } catch (NoSuchFieldException error) {
            transportType = transportType.getSuperclass();
            if (Object.class.equals(transportType)) {
                transportType = null;
            }
        }
    }

    assertNotNull("Transport implementation unknown", group);

    group.setAccessible(true);
    if (expected) {
        assertTrue(message, group.get(transport) instanceof KQueueEventLoopGroup);
    } else {
        assertFalse(message, group.get(transport) instanceof KQueueEventLoopGroup);
    }
}
项目:reactor-netty    文件:DefaultLoopKQueue.java   
@Override
public EventLoopGroup newEventLoopGroup(int threads, ThreadFactory factory) {
    return new KQueueEventLoopGroup(threads, factory);
}
项目:reactor-netty    文件:DefaultLoopKQueue.java   
private boolean useKQueue(EventLoopGroup group) {
    if (group instanceof ColocatedEventLoopGroup) {
        group = ((ColocatedEventLoopGroup) group).get();
    }
    return group instanceof KQueueEventLoopGroup;
}