Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFactory


public class RpcServer extends RpcPeer {

    ServerBootstrap bootstrap;

    public RpcServer() {
        ChannelFactory channelFactory = new NioServerSocketChannelFactory(
                Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool());
        bootstrap = new ServerBootstrap(channelFactory);
        bootstrap.setPipelineFactory(new RpcChannelPiplineFactory(this));
    }
View Full Code Here


    ClientBootstrap bootstrap;
    private volatile RpcChannel rpcChannel;

    public RpcClient() {
        ChannelFactory channelFactory = new NioClientSocketChannelFactory(
                Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool());

        bootstrap = new ClientBootstrap(channelFactory);
        bootstrap.setPipelineFactory(new RpcChannelPiplineFactory(this));
View Full Code Here

  @Override
  public void startUp() throws Exception {
    for (String inputName : spec.getInputSchemas().keySet()) {
      Map.Entry<InputStreamFormat, StreamSchema> streamInfo = spec.getInputSchemas().get(inputName);
      ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                 Executors.newCachedThreadPool());
      InputServerSocket service;
      switch(streamInfo.getKey()) {
        case GDAT:
          service = new InputServerSocket(factory, inputName, streamInfo.getValue(),
                                          portMap.get(Constants.TCP_INGESTION_PORT_PREFIX + inputName));
          break;

        case JSON:
          service = new JsonInputServerSocket(factory, inputName, streamInfo.getValue(),
                                              portMap.get(Constants.TCP_INGESTION_PORT_PREFIX + inputName));
          break;

        default:
          throw new Exception("Unknown Input Format. Only JSON and GDAT Formats are supported.");
      }

      service.startAndWait();
      portMap.put(Constants.TCP_INGESTION_PORT_PREFIX + inputName, service.getIngestionPort());
      inputServerMap.put(inputName, service.getSocketAddressMap());
      dataIngressServerMap.put(inputName, service.getSocketAddressMap().get(Constants.StreamIO.TCP_DATA_INGESTION));
      dataSourceServerMap.put(inputName, service.getSocketAddressMap().get(Constants.StreamIO.DATASOURCE));
      inputServerSocketServices.add(service);
    }

    for (Map.Entry<String, String> output : spec.getQuery().entrySet()) {
      ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
                                                                 Executors.newCachedThreadPool());
      StreamSocketServer service = new OutputServerSocket(factory, output.getKey(), output.getValue(), recordQueue);
      service.startAndWait();
      outputServerMap.put(output.getKey(), service.getSocketAddressMap());
      dataEgressServerMap.put(output.getKey(), service.getSocketAddressMap().get(Constants.StreamIO.DATASINK));
View Full Code Here

  private final ConcurrentMap<String, Channel> channelList = Maps.newConcurrentMap();
  private final ClientBootstrap clientBootstrap;

  public HttpRouterClientService(Map<String, InetSocketAddress> ingestionServerMap) {
    this.serverMap = ingestionServerMap;
    ChannelFactory factory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                                                               Executors.newCachedThreadPool());
    this.clientBootstrap = new ClientBootstrap(factory);
  }
View Full Code Here

    }
  }

  @Override
  public void start() {
    ChannelFactory factory = new NioServerSocketChannelFactory(
        Executors.newCachedThreadPool(), Executors.newCachedThreadPool());

    ServerBootstrap serverBootstrap = new ServerBootstrap(factory);
    serverBootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      public ChannelPipeline getPipeline() {
View Full Code Here

    };
  }
 
  public void run() {
    // Configure the Server.
    ChannelFactory factory;
    if (workerCount == 0) {
      // Use default workers: 2 * the number of available processors
      factory = new NioServerSocketChannelFactory(
          Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
    } else {
View Full Code Here

    return this.pipelineFactory;
  }

  public void run() {
    // Configure the client.
    ChannelFactory factory = new NioClientSocketChannelFactory(
        Executors.newCachedThreadPool(), Executors.newCachedThreadPool(), 1, 1);
    ClientBootstrap bootstrap = new ClientBootstrap(factory);

    // Set up the pipeline factory.
    bootstrap.setPipelineFactory(setPipelineFactory());
View Full Code Here

    @Override
    protected void doOpen() throws Throwable {
        ExecutorService boss = Executors.newCachedThreadPool(new NamedThreadFactory("NettyServerBoss", true));
        ExecutorService worker = Executors.newCachedThreadPool(new NamedThreadFactory("NettyServerWorker", true));
        ChannelFactory channelFactory = new NioServerSocketChannelFactory(boss, worker, getUrl().getPositiveParameter(Constants.IO_THREADS_KEY, Constants.DEFAULT_IO_THREADS));
        bootstrap = new ServerBootstrap(channelFactory);
       
        final NettyHandler nettyHandler = new NettyHandler(getUrl(), this);
        channels = nettyHandler.getChannels();
        // https://issues.jboss.org/browse/NETTY-365
View Full Code Here

    this.socketAddress = socketAddress;
    this.filterBySub = filterBySub;
    runner = executor;

    final ChannelFactory channelFactory =
        new NioServerSocketChannelFactory(executor, executor);

    boot = new ServerBootstrap(channelFactory);

    final ChannelPipelineFactory pipelineFactory = new PipelineFactoryDDF(this);
View Full Code Here

    this.socketAddress = socketAddress;
    this.filterBySub = filterBySub;
    runner = executor;

    final ChannelFactory channelFactory =
        new NioServerSocketChannelFactory(executor, executor);

    boot = new ServerBootstrap(channelFactory);

    final ChannelPipelineFactory pipelineFactory =
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.ChannelFactory

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.