Example usage for io.netty.channel EventLoop parent

List of usage examples for io.netty.channel EventLoop parent

Introduction

In this page you can find the example usage for io.netty.channel EventLoop parent.

Prototype

@Override
    EventLoopGroup parent();

Source Link

Usage

From source file:com.linecorp.armeria.client.endpoint.dns.DnsEndpointGroup.java

License:Apache License

DnsEndpointGroup(EventLoop eventLoop, int minTtl, int maxTtl,
        DnsServerAddressStreamProvider serverAddressStreamProvider, Backoff backoff,
        Iterable<DnsQuestion> questions, Consumer<DnsNameResolverBuilder> resolverConfigurator) {

    this.eventLoop = eventLoop;
    this.minTtl = minTtl;
    this.maxTtl = maxTtl;
    this.backoff = backoff;
    this.questions = ImmutableList.copyOf(questions);
    assert !this.questions.isEmpty();
    logger = LoggerFactory.getLogger(getClass());
    logPrefix = this.questions.stream().map(DnsQuestion::name).distinct()
            .collect(Collectors.joining(", ", "[", "]"));

    final DnsNameResolverBuilder resolverBuilder = new DnsNameResolverBuilder(eventLoop)
            .channelType(TransportType.datagramChannelType(eventLoop.parent())).ttl(minTtl, maxTtl)
            .nameServerProvider(serverAddressStreamProvider);

    resolverConfigurator.accept(resolverBuilder);
    resolver = resolverBuilder.build();/* w  ww .j  a va 2s.c o  m*/
}

From source file:com.linecorp.armeria.internal.TransportType.java

License:Apache License

/**
 * Returns whether the specified {@link EventLoop} supports any {@link TransportType}.
 *//*ww  w. j a  va 2s.  com*/
public static boolean isSupported(EventLoop eventLoop) {
    final EventLoopGroup parent = eventLoop.parent();
    if (parent == null) {
        return false;
    }
    return isSupported(parent);
}

From source file:org.hawkular.metrics.clients.ptrans.backend.RestForwardingHandlerITest.java

License:Apache License

@Before
public void setUp() throws Exception {
    Channel channel = mock(Channel.class);
    when(channelHandlerContext.channel()).thenReturn(channel);
    EventLoop eventLoop = mock(EventLoop.class);
    when(channel.eventLoop()).thenReturn(eventLoop);
    EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
    when(eventLoop.parent()).thenReturn(eventLoopGroup);

    Properties properties = new Properties();
    String addNumericDataUrl = "http://" + BASE_URI + "/" + TENANT + "/metrics/numeric/data";
    properties.setProperty(ConfigurationKey.REST_URL.getExternalForm(), addNumericDataUrl);
    Configuration configuration = Configuration.from(properties);

    restForwardingHandler = new RestForwardingHandler(configuration);

    findNumericDataUrl = "http://" + BASE_URI + "/" + TENANT + "/metrics/numeric/" + METRIC_NAME + "/data";
}