Search in sources :

Example 16 with EpollEventLoopGroup

use of io.netty.channel.epoll.EpollEventLoopGroup in project aerospike-client-java by aerospike.

the class SuiteAsync method init.

@BeforeClass
public static void init() {
    System.out.println("Begin AerospikeClient");
    Args args = Args.Instance;
    switch(args.eventLoopType) {
        default:
        case DIRECT_NIO:
            {
                eventLoops = new NioEventLoops(1);
                break;
            }
        case NETTY_NIO:
            {
                EventLoopGroup group = new NioEventLoopGroup(1);
                eventLoops = new NettyEventLoops(group);
                break;
            }
        case NETTY_EPOLL:
            {
                EventLoopGroup group = new EpollEventLoopGroup(1);
                eventLoops = new NettyEventLoops(group);
                break;
            }
    }
    try {
        ClientPolicy policy = new ClientPolicy();
        policy.eventLoops = eventLoops;
        policy.user = args.user;
        policy.password = args.password;
        policy.tlsPolicy = args.tlsPolicy;
        Host[] hosts = Host.parseHosts(args.host, args.port);
        eventLoop = eventLoops.get(0);
        client = new AerospikeClient(policy, hosts);
        try {
            args.setServerSpecific(client);
        } catch (RuntimeException re) {
            client.close();
            throw re;
        }
    } catch (Exception e) {
        eventLoops.close();
        throw e;
    }
}
Also used : AerospikeClient(com.aerospike.client.AerospikeClient) Args(com.aerospike.test.util.Args) ClientPolicy(com.aerospike.client.policy.ClientPolicy) EventLoopGroup(io.netty.channel.EventLoopGroup) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) EpollEventLoopGroup(io.netty.channel.epoll.EpollEventLoopGroup) NettyEventLoops(com.aerospike.client.async.NettyEventLoops) EpollEventLoopGroup(io.netty.channel.epoll.EpollEventLoopGroup) Host(com.aerospike.client.Host) NioEventLoops(com.aerospike.client.async.NioEventLoops) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) BeforeClass(org.junit.BeforeClass)

Aggregations

EpollEventLoopGroup (io.netty.channel.epoll.EpollEventLoopGroup)16 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)12 EventLoopGroup (io.netty.channel.EventLoopGroup)8 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)4 DefaultThreadFactory (io.netty.util.concurrent.DefaultThreadFactory)4 AerospikeClient (com.aerospike.client.AerospikeClient)3 NettyEventLoops (com.aerospike.client.async.NettyEventLoops)3 NioEventLoops (com.aerospike.client.async.NioEventLoops)3 SocketChannel (io.netty.channel.socket.SocketChannel)3 Host (com.aerospike.client.Host)2 ClientPolicy (com.aerospike.client.policy.ClientPolicy)2 JCommander (com.beust.jcommander.JCommander)2 ParameterException (com.beust.jcommander.ParameterException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)2 RateLimiter (com.google.common.util.concurrent.RateLimiter)2 ClientConfiguration (com.yahoo.pulsar.client.api.ClientConfiguration)2 PulsarClient (com.yahoo.pulsar.client.api.PulsarClient)2 PulsarClientImpl (com.yahoo.pulsar.client.impl.PulsarClientImpl)2 AdaptiveRecvByteBufAllocator (io.netty.channel.AdaptiveRecvByteBufAllocator)2