Package io.netty.bootstrap

Examples of io.netty.bootstrap.ServerBootstrap.bind()


        this.bootstrap = bootstrap;

        // Start 'er up
        final ChannelFuture openChannel;
        try {
            openChannel = bootstrap.bind().sync();
        } catch (final InterruptedException ie) {
            Thread.interrupted();
            throw new ServerLifecycleException("Interrupted while awaiting server start", ie);
        } catch (final RuntimeException re) {
            // Exception xlate
View Full Code Here


            bootstrap.childHandler(new Initializer(this));
        }

        // Bind and start to accept incoming connections.
        logger.info("Starting listening for CQL clients on {}...", socket);
        Channel channel = bootstrap.bind(socket).channel();
        connectionTracker.allChannels.add(channel);
        isRunning.set(true);
    }

    private void registerMetrics()
View Full Code Here

        }

        // Bind and start to accept incoming connections.
        logger.info("Using Netty Version: {}", Version.identify().entrySet());
        logger.info("Starting listening for CQL clients on {}...", socket);
        Channel channel = bootstrap.bind(socket).channel();
        connectionTracker.allChannels.add(channel);
        isRunning.set(true);
    }

    private void registerMetrics()
View Full Code Here

            channelizer.init(settings, gremlinExecutor, gremlinGroup, graphs.get(), workerGroup);
            b.group(bossGroup, workerGroup)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(channelizer);

            ch = b.bind(settings.host, settings.port).sync().channel();
            logger.info("Gremlin Server configured with worker thread pool of {} and boss thread pool of {}",
                    settings.threadPoolWorker, settings.threadPoolBoss);
            logger.info("Channel started at port {}.", settings.port);

            serverReady.ifPresent(future -> future.complete(null));
View Full Code Here

        } else {
            address = new InetSocketAddress(host, port);
        }
        // Bind and start to accept incoming connections.
        try {
            return bootstrap.bind(address).sync().channel();
        } catch (InterruptedException ex) {
            // do nothing here
            return null;
        }
    }
View Full Code Here

                ch.pipeline().addLast("handler",new MessageHandler(server,allClientChannels));
            }
        });

        // Bind and start to accept incoming connections.
        ChannelFuture f = b.bind(port).sync();

        serverChannel = f.channel();

        logger.info("Netty server started on port "+port);
View Full Code Here

        .channel(OioServerSocketChannel.class)
        .option(ChannelOption.SO_BACKLOG, 100)
        .option(ChannelOption.SO_RCVBUF, 1500)
        .childHandler(new FileServerChannelInitializer(pResolver));
    // Start the server.
    channelFuture = bootstrap.bind(addr);
    try {
      // Get the address we bound to.
      InetSocketAddress boundAddress =
        ((InetSocketAddress) channelFuture.sync().channel().localAddress());
      this.port = boundAddress.getPort();
View Full Code Here

        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();

        log.info("Web socket server started at port {}.", port);
    }

    public void triggerReload(String path) throws JSONException {
View Full Code Here

                            ch.pipeline().addLast(new MongoDatabaseHandler(backend, channelGroup));
                            ch.pipeline().addLast(new MongoExceptionHandler());
                        }
                    });

            channel = bootstrap.bind().syncUninterruptibly().channel();

            log.info("started {}", this);
        } catch (RuntimeException e) {
            shutdownNow();
            throw e;
View Full Code Here

          .channel(NioServerSocketChannel.class)
          .option(ChannelOption.SO_BACKLOG, 1024)
          .option(ChannelOption.SO_REUSEADDR, true)
          .childHandler(new DiamondServerInitializer(serverHandler));
       
        b.bind("0.0.0.0", port).sync().channel();
        logger.info("启动 Diamond Netty Server, post={}", port);
  }

  @Override
  public void destroy() throws Exception {
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.