Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFactory


    @Test
    @Override
    public void shouldNotAllowFactoryToChangeMoreThanOnce() {
        Bootstrap b = newBootstrap();
        ChannelFactory f = createMock(ServerChannelFactory.class);
        b.setFactory(f);
        assertSame(f, b.getFactory());

        try {
            b.setFactory(createMock(ServerChannelFactory.class));
View Full Code Here


    }

    @Test
    public void shouldNotAllowFactoryToChangeMoreThanOnce() {
        Bootstrap b = newBootstrap();
        ChannelFactory f = createMock(ChannelFactory.class);
        b.setFactory(f);
        assertSame(f, b.getFactory());

        try {
            b.setFactory(createMock(ChannelFactory.class));
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

    Thread.sleep(10 * 1000);
  }

  private ServerBootstrap createServerBootstrap(final StringBuilder result) {
    ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
          Executors.newCachedThreadPool());
    ServerBootstrap bootstrap = new ServerBootstrap(factory);

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

      address = new InetSocketAddress(m_host, m_port);
    }

    ExecutorService bossExecutor = Threads.forPool().getCachedThreadPool("Cat-TcpSocketReceiver-Boss-" + address);
    ExecutorService workerExecutor = Threads.forPool().getCachedThreadPool("Cat-TcpSocketReceiver-Worker");
    ChannelFactory factory = new NioServerSocketChannelFactory(bossExecutor, workerExecutor);
    ServerBootstrap bootstrap = new ServerBootstrap(factory);

    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      @Override
      public ChannelPipeline getPipeline() {
View Full Code Here

    m_queue = queue;
    m_configManager = configManager;

    ExecutorService bossExecutor = Threads.forPool().getFixedThreadPool("Cat-TcpSocketSender-Boss", 10);
    ExecutorService workerExecutor = Threads.forPool().getFixedThreadPool("Cat-TcpSocketSender-Worker", 10);
    ChannelFactory factory = new NioClientSocketChannelFactory(bossExecutor, workerExecutor);
    ClientBootstrap bootstrap = new ClientBootstrap(factory);

    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      @Override
      public ChannelPipeline getPipeline() {
View Full Code Here

    /**
     * Start server
     */
    public void start() {
        ChannelFactory factory = new NioServerSocketChannelFactory(configCopy.getBossExecutor(), configCopy.getWorkerExecutor());
        bootstrap = new ServerBootstrap(factory);

        InetSocketAddress addr = new InetSocketAddress(configCopy.getPort());
        if (configCopy.getHostname() != null) {
            addr = new InetSocketAddress(configCopy.getHostname(), configCopy.getPort());
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

        int clusterSize = this.topology.getTopology().getNodes().size();

        partitionChannelMap = HashBiMap.create(clusterSize);
        partitionNodeMap = HashBiMap.create(clusterSize);

        ChannelFactory factory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool());

        bootstrap = new ClientBootstrap(factory);

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

    @Inject
    public TCPListener(Assignment assignment) {
        // wait for an assignment
        node = assignment.assignClusterNode();
       
        ChannelFactory factory =
            new NioServerSocketChannelFactory(
                    Executors.newCachedThreadPool(),
                    Executors.newCachedThreadPool());

        ServerBootstrap 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.