Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFactory


    @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


  public MysqlConnectionManager(String host, int port, String username, String password, String schema, Properties properties) {
    super(username, password, schema, properties);
    executorService = Executors.newCachedThreadPool();

    ChannelFactory factory = new NioClientSocketChannelFactory(executorService, executorService);
    bootstrap = new ClientBootstrap(factory);
    init(host, port);
  }
View Full Code Here

  }

  public NettyConnectionManager(String host, int port, String username, String password, String database, Properties properties) {
    super(username, password, database);
    executorService = Executors.newCachedThreadPool();
    ChannelFactory channelFactory = new NioClientSocketChannelFactory(executorService, executorService);
    bootstrap = initBootstrap(channelFactory, host, port);
  }
View Full Code Here

     *         if the factory is not set for this bootstrap yet.
     *         The factory can be set in the constructor or
     *         {@link #setFactory(ChannelFactory)}.
     */
    public ChannelFactory getFactory() {
        ChannelFactory factory = this.factory;
        if (factory == null) {
            throw new IllegalStateException(
                    "factory is not set yet.");
        }
        return factory;
View Full Code Here

    public TCPListener(Assignment assignment, @Named("s4.comm.timeout") int timeout, final Receiver receiver,
            final DeserializerExecutorFactory deserializerExecutorFactory) {
        // wait for an assignment
        node = assignment.assignClusterNode();
        nettyTimeout = timeout;
        ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool());

        bootstrap = new ServerBootstrap(factory);

        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
View Full Code Here

        int clusterSize = this.topology.getPhysicalCluster().getNodes().size();
        partitionChannelMap = HashBiMap.create(clusterSize);
        partitionNodeMap = HashBiMap.create(clusterSize);

        // Initialize netty related structures
        ChannelFactory factory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool());
        bootstrap = new ClientBootstrap(factory);
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            @Override
            public ChannelPipeline getPipeline() {
View Full Code Here

     *         if the factory is not set for this bootstrap yet.
     *         The factory can be set in the constructor or
     *         {@link #setFactory(ChannelFactory)}.
     */
    public ChannelFactory getFactory() {
        ChannelFactory factory = this.factory;
        if (factory == null) {
            throw new IllegalStateException(
                    "factory is not set yet.");
        }
        return factory;
View Full Code Here

    /**
     * {@inheritDoc}  This method simply delegates the call to
     * {@link ChannelFactory#releaseExternalResources()}.
     */
    public void releaseExternalResources() {
        ChannelFactory factory = this.factory;
        if (factory != null) {
            factory.releaseExternalResources();
        }
    }
View Full Code Here

      log.error("not yet connected");
    }
  }

  private void initConnection() {
    ChannelFactory factory = new NioClientSocketChannelFactory(
        Executors.newCachedThreadPool(),
        Executors.newCachedThreadPool());

    bootstrap = new ClientBootstrap(factory);
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public void init() {
    log.info("starting tcp connector...");
      ChannelFactory factory =
                new NioServerSocketChannelFactory(
                        Executors.newCachedThreadPool(),
                        Executors.newCachedThreadPool());

            bootstrap = new ServerBootstrap(factory);
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.