Examples of EpollEventLoopGroup


Examples of io.netty.channel.epoll.EpollEventLoopGroup

    public void run() throws Exception {
  // Configure the server.

  if (Epoll.isAvailable()) {
      doRun(new EpollEventLoopGroup(), EpollServerSocketChannel.class);
  } else {
      doRun(new NioEventLoopGroup(), NioServerSocketChannel.class);
  }
    }
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup

        bootstrap.option(ChannelOption.SO_BACKLOG, config.getAcceptBackLog());
    }

    protected void initGroups() {
        if (configCopy.isUseLinuxNativeEpoll()) {
            bossGroup = new EpollEventLoopGroup(configCopy.getBossThreads());
            workerGroup = new EpollEventLoopGroup(configCopy.getWorkerThreads());
        } else {
            bossGroup = new NioEventLoopGroup(configCopy.getBossThreads());
            workerGroup = new NioEventLoopGroup(configCopy.getWorkerThreads());
        }
    }
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup

    }
  }

  public static EventLoopGroup createEventLoopGroup(int nThreads, String prefix) {
     if(SUPPORTS_EPOLL){
       return new EpollEventLoopGroup(nThreads, new NamedThreadFactory(prefix));
     }else{
       return new NioEventLoopGroup(nThreads, new NamedThreadFactory(prefix));
     }
  }
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup

    private EpollEventLoopGroup getNativeParentEventLoop() {
        if (nativeParentEventLoop == nativeEventLoop) { // Means using same event loop for acceptor and worker pool.
            return getNativeEventLoop();
        }

        EpollEventLoopGroup eventLoopGroup = nativeParentEventLoop.get();
        if (null == eventLoopGroup) {
            EpollEventLoopGroup newEventLoopGroup = new EpollEventLoopGroup(parentEventLoopCount);
            if (!nativeParentEventLoop.compareAndSet(null, newEventLoopGroup)) {
                newEventLoopGroup.shutdownGracefully();
            }
        }
        return nativeParentEventLoop.get();
    }
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup

        }
        return nativeParentEventLoop.get();
    }

    private EpollEventLoopGroup getNativeEventLoop() {
        EpollEventLoopGroup eventLoopGroup = nativeEventLoop.get();
        if (null == eventLoopGroup) {
            EpollEventLoopGroup newEventLoopGroup = new EpollEventLoopGroup(childEventLoopCount);
            if (!nativeEventLoop.compareAndSet(null, newEventLoopGroup)) {
                newEventLoopGroup.shutdownGracefully();
            }
        }
        return nativeEventLoop.get();
    }
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup


        boolean hasEpoll = enableEpoll ? Epoll.isAvailable() : false;
        if (hasEpoll)
        {
            workerGroup = new EpollEventLoopGroup();
            logger.info("Netty using native Epoll event loop");
        }
        else
        {
            workerGroup = new NioEventLoopGroup();
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup

    switch (mode) {
      case NIO:
        return new NioEventLoopGroup(numThreads, threadFactory);
      case EPOLL:
        return new EpollEventLoopGroup(numThreads, threadFactory);
      default:
        throw new IllegalArgumentException("Unknown io mode: " + mode);
    }
  }
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup

    EventLoopGroup workerGroup;
    int bossThreadCount = WorkerConf.get().NETTY_BOSS_THREADS;
    int workerThreadCount = WorkerConf.get().NETTY_WORKER_THREADS;
    switch (type) {
      case EPOLL:
        bossGroup = new EpollEventLoopGroup(bossThreadCount, bossThreadFactory);
        workerGroup = new EpollEventLoopGroup(workerThreadCount, workerThreadFactory);
        boot.channel(EpollServerSocketChannel.class);
        break;
      default:
        bossGroup = new NioEventLoopGroup(bossThreadCount, bossThreadFactory);
        workerGroup = new NioEventLoopGroup(workerThreadCount, workerThreadFactory);
View Full Code Here

Examples of io.netty.channel.epoll.EpollEventLoopGroup

        }
    }

    public static EventLoopGroup newEventLoopGroup(int threads, ThreadFactory factory)
    {
        return epoll ? new EpollEventLoopGroup( threads, factory ) : new NioEventLoopGroup( threads, factory );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.