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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations