Package io.netty.channel.nio

Examples of io.netty.channel.nio.NioEventLoopGroup


        MasterSlaveEntry entry = new MasterSlaveEntry(codec, group, config);
        entries.put(Integer.MAX_VALUE, entry);
    }

    protected void init(Config cfg) {
        this.group = new NioEventLoopGroup(cfg.getThreads());
        this.codec = new RedisCodecWrapper(cfg.getCodec());
    }
View Full Code Here


    }
  }

  private void init() {
    int workerCount = getRuntime().availableProcessors();
    NioEventLoopGroup group = new NioEventLoopGroup(workerCount, new NamedThreadFactory("PG-JDBC EventLoop"));

    bootstrap = new Bootstrap();
    bootstrap.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() {
      @Override
      protected void initChannel(SocketChannel ch) throws Exception {
View Full Code Here

    @Activate
    protected void activate(ComponentContext ctx) throws Exception {
        Dictionary<?, ?> props = ctx.getProperties();
        this.port = PropertiesUtil.toInteger(props.get(PROP_PORT), DEFAULT_PORT);
        this.pathPrefixes = PropertiesUtil.toStringArray(props.get(PROP_PREFIXES), DEFAULT_PREFIXES);
        this.broadcastGroup = new NioEventLoopGroup(1);

        this.group = new DefaultChannelGroup("live-reload", broadcastGroup.next());
        this.infos = new ConcurrentHashMap<Channel, ChannelInfo>();

        this.matcher = new ContentPageMatcher();
View Full Code Here

    private void stopServer() throws InterruptedException {
        serverChannel.close().sync();
    }

    private void startServer() throws Exception {
        this.bossGroup = new NioEventLoopGroup();
        this.workerGroup = new NioEventLoopGroup();
        ServerBootstrap b = new ServerBootstrap();
        b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
                .childHandler(new WebSocketServerInitializer());

        this.serverChannel = b.bind(this.port).sync().channel();
View Full Code Here

        this.backend = backend;
    }

    public void bind(SocketAddress socketAddress) {

        bossGroup = new NioEventLoopGroup();
        workerGroup = new NioEventLoopGroup();
        channelGroup = new DefaultChannelGroup("mongodb-channels", workerGroup.next());

        try {
            ServerBootstrap bootstrap = new ServerBootstrap();
            bootstrap//
View Full Code Here

    /**
     * Creates a server listening on specified address.
     */
    public NettyServer(LocalHost localHost, String address, int port, ConnectListener connectListener) {
        bossGroup = new NioEventLoopGroup();
        workerGroup = new NioEventLoopGroup();

        bootstrap = new ServerBootstrap();
        bootstrap.group(bossGroup, workerGroup)
                .channel(NioServerSocketChannel.class)
                .childHandler(new NettyChannelInitializer(localHost, connectListener))
View Full Code Here

     * Creates client that connect to server on specified host and port.
     * @param host the host where server listens on
     * @param port the port that server listens on
     */
    public NettyClient(LocalHost localHost, String host, int port, ConnectListener connectListener) {
        workerGroup = new NioEventLoopGroup();

        bootstrap = new Bootstrap();
        bootstrap.group(workerGroup)
                .channel(NioSocketChannel.class)
                .handler(new NettyChannelInitializer(localHost, connectListener))
View Full Code Here

    public void run() throws Exception {
        // Configure the server.
        ServerBootstrap b = new ServerBootstrap();
        try {
            b.group(new NioEventLoopGroup(), new NioEventLoopGroup())
             .channel(NioServerSocketChannel.class)
             .option(ChannelOption.SO_BACKLOG, 100)
             .handler(new LoggingHandler(LogLevel.INFO))
             .childHandler(new ChannelInitializer<SocketChannel>() {
                 @Override
View Full Code Here

    }

    public void run() throws Exception {
        Bootstrap b = new Bootstrap();
        try {
            b.group(new NioEventLoopGroup())
             .channel(NioSocketChannel.class)
             .handler(new DiscardClientHandler(firstMessageSize));

            // Make the connection attempt.
            ChannelFuture f = b.connect(host, port).sync();
View Full Code Here

    }

    public void run() throws Exception {
        ServerBootstrap b = new ServerBootstrap();
        try {
            b.group(new NioEventLoopGroup(), new NioEventLoopGroup())
             .channel(NioServerSocketChannel.class)
             .childHandler(new ChannelInitializer<SocketChannel>() {
                @Override
                public void initChannel(SocketChannel ch) throws Exception {
                    ch.pipeline().addLast(new DiscardServerHandler());
View Full Code Here

TOP

Related Classes of io.netty.channel.nio.NioEventLoopGroup

Copyright © 2018 www.massapicom. 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.