Search in sources :

Example 96 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project storm by nathanmarz.

the class StormServerPipelineFactory method getPipeline.

public ChannelPipeline getPipeline() throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = Channels.pipeline();
    // Decoder
    pipeline.addLast("decoder", new MessageDecoder());
    // Encoder
    pipeline.addLast("encoder", new MessageEncoder());
    // business logic.
    pipeline.addLast("handler", new StormServerHandler(server));
    return pipeline;
}
Also used : ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 97 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project voldemort by voldemort.

the class CoordinatorAdminPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("decoder", new HttpRequestDecoder());
    pipeline.addLast("aggregator", new HttpChunkAggregator(MAX_AGGREGATE_SIZE));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("deflater", new HttpContentCompressor());
    pipeline.addLast("handler", new CoordinatorAdminRequestHandler(storeClientConfigs));
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) HttpContentCompressor(org.jboss.netty.handler.codec.http.HttpContentCompressor) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 98 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project voldemort by voldemort.

the class CoordinatorPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("connectionStats", connectionStatsHandler);
    pipeline.addLast("decoder", new HttpRequestDecoder(this.coordinatorConfig.getHttpMessageDecoderMaxInitialLength(), this.coordinatorConfig.getHttpMessageDecoderMaxHeaderSize(), this.coordinatorConfig.getHttpMessageDecoderMaxChunkSize()));
    pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("deflater", new HttpContentCompressor());
    pipeline.addLast("handler", new RestCoordinatorRequestHandler(fatClientMap));
    pipeline.addLast("coordinatorExecutionHandler", coordinatorExecutionHandler);
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) HttpContentCompressor(org.jboss.netty.handler.codec.http.HttpContentCompressor) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 99 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850Config method serverBootstrap.

/**
     * Returns a ServerBootstrap setting up a server pipeline listening for
     * incoming IEC61850 register device requests.
     *
     * @return an IEC61850 server bootstrap.
     */
@Bean(destroyMethod = "releaseExternalResources")
public ServerBootstrap serverBootstrap() {
    final ChannelFactory factory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
    final ServerBootstrap bootstrap = new ServerBootstrap(factory);
    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {

        @Override
        public ChannelPipeline getPipeline() throws ProtocolAdapterException {
            final ChannelPipeline pipeline = Iec61850Config.this.createChannelPipeline(Iec61850Config.this.iec61850ChannelHandlerServer());
            LOGGER.info("Created new IEC61850 handler pipeline for server");
            return pipeline;
        }
    });
    bootstrap.setOption("child.tcpNoDelay", true);
    bootstrap.setOption("child.keepAlive", false);
    bootstrap.bind(new InetSocketAddress(this.iec61850PortListener()));
    return bootstrap;
}
Also used : NioServerSocketChannelFactory(org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory) InetSocketAddress(java.net.InetSocketAddress) ProtocolAdapterException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) NioServerSocketChannelFactory(org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory) ChannelFactory(org.jboss.netty.channel.ChannelFactory) ChannelPipelineFactory(org.jboss.netty.channel.ChannelPipelineFactory) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) Bean(org.springframework.context.annotation.Bean)

Example 100 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project opennms by OpenNMS.

the class AsyncBasicDetectorNettyImpl method isServiceDetected.

/** {@inheritDoc} */
@Override
public final DetectFuture isServiceDetected(final InetAddress address) {
    DetectFuture detectFuture = new DetectFutureFailedImpl(this, new IllegalStateException());
    try {
        ClientBootstrap bootstrap = new ClientBootstrap(m_factory);
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {

            @Override
            public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline retval = Channels.pipeline();
                // Upstream handlers
                //retval.addLast("retryHandler", new RetryChannelHandler());
                appendToPipeline(retval);
                // Downstream handlers
                retval.addLast("detectorHandler", getDetectorHandler(getConversation()));
                if (isUseSSLFilter()) {
                    // Use a relaxed SSL context
                    retval.addLast("sslHandler", new SslHandler(createClientSSLContext().createSSLEngine()));
                }
                return retval;
            }
        });
        bootstrap.setOption("tcpNoDelay", true);
        bootstrap.setOption("keepAlive", true);
        SocketAddress remoteAddress = new InetSocketAddress(address, getPort());
        ChannelFuture future = bootstrap.connect(remoteAddress);
        future.addListener(new RetryChannelFutureListener(remoteAddress, this.getRetries()));
        detectFuture = new DetectFutureNettyImpl(this, future);
    } catch (Throwable e) {
        detectFuture = new DetectFutureFailedImpl(this, e);
    }
    return detectFuture;
}
Also used : ChannelFuture(org.jboss.netty.channel.ChannelFuture) InetSocketAddress(java.net.InetSocketAddress) IOException(java.io.IOException) KeyManagementException(java.security.KeyManagementException) ServiceDetectionFailedException(org.opennms.netmgt.provision.support.DetectFutureNettyImpl.ServiceDetectionFailedException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) SslHandler(org.jboss.netty.handler.ssl.SslHandler) DetectFuture(org.opennms.netmgt.provision.DetectFuture) ClientBootstrap(org.jboss.netty.bootstrap.ClientBootstrap) SocketAddress(java.net.SocketAddress) InetSocketAddress(java.net.InetSocketAddress) ChannelPipelineFactory(org.jboss.netty.channel.ChannelPipelineFactory)

Aggregations

ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)105 InetSocketAddress (java.net.InetSocketAddress)32 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)29 SimpleObjectCaptureHandler (com.linkedin.databus2.test.container.SimpleObjectCaptureHandler)24 Channel (org.jboss.netty.channel.Channel)23 SocketAddress (java.net.SocketAddress)20 SimpleTestServerConnection (com.linkedin.databus2.test.container.SimpleTestServerConnection)17 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)16 DefaultHttpResponse (org.jboss.netty.handler.codec.http.DefaultHttpResponse)15 HttpRequest (org.jboss.netty.handler.codec.http.HttpRequest)15 HttpResponse (org.jboss.netty.handler.codec.http.HttpResponse)15 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)13 HttpResponseEncoder (org.jboss.netty.handler.codec.http.HttpResponseEncoder)13 LoggingHandler (org.jboss.netty.handler.logging.LoggingHandler)13 Checkpoint (com.linkedin.databus.core.Checkpoint)12 HttpRequestDecoder (org.jboss.netty.handler.codec.http.HttpRequestDecoder)12 ConditionCheck (com.linkedin.databus2.test.ConditionCheck)11 NioServerSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory)11 Test (org.testng.annotations.Test)11 DbusEventBuffer (com.linkedin.databus.core.DbusEventBuffer)10