本文整理汇总了Java中org.jboss.netty.channel.Channels.pipeline方法的典型用法代码示例。如果您正苦于以下问题:Java Channels.pipeline方法的具体用法?Java Channels.pipeline怎么用?Java Channels.pipeline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.netty.channel.Channels
的用法示例。
在下文中一共展示了Channels.pipeline方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline channelPipeline = Channels.pipeline();
SizeHeaderFrameDecoder sizeHeader = new SizeHeaderFrameDecoder();
if (nettyTransport.maxCumulationBufferCapacity != null) {
if (nettyTransport.maxCumulationBufferCapacity.bytes() > Integer.MAX_VALUE) {
sizeHeader.setMaxCumulationBufferCapacity(Integer.MAX_VALUE);
} else {
sizeHeader.setMaxCumulationBufferCapacity((int) nettyTransport.maxCumulationBufferCapacity.bytes());
}
}
if (nettyTransport.maxCompositeBufferComponents != -1) {
sizeHeader.setMaxCumulationBufferComponents(nettyTransport.maxCompositeBufferComponents);
}
channelPipeline.addLast("size", sizeHeader);
// using a dot as a prefix means, this cannot come from any settings parsed
channelPipeline.addLast("dispatcher", new MessageChannelHandler(nettyTransport, nettyTransport.logger, ".client"));
return channelPipeline;
}
示例2: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
if (sslFactory != null) {
pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine()));
}
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16));
pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("chunking", new ChunkedWriteHandler());
pipeline.addLast("shuffle", SHUFFLE);
return pipeline;
// TODO factor security manager into pipeline
// TODO factor out encode/decode to permit binary shuffle
// TODO factor out decode of index to permit alt. models
}
示例3: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
BootstrapChannelHandler handler =
new BootstrapChannelHandler(bootstrap);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("frameDecoder",
new ThriftFrameDecoder(maxFrameSize));
pipeline.addLast("frameEncoder",
new ThriftFrameEncoder());
pipeline.addLast("timeout",
new BootstrapTimeoutHandler(timer, 10));
pipeline.addLast("handler", handler);
return pipeline;
}
示例4: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
BgpChannelHandler handler = new BgpChannelHandler(bgpController);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("bgpmessagedecoder", new BgpMessageDecoder());
pipeline.addLast("bgpmessageencoder", new BgpMessageEncoder());
pipeline.addLast("holdTime", readTimeoutHandler);
if (isBgpServ) {
pipeline.addLast("PassiveHandler", handler);
} else {
pipeline.addLast("ActiveHandler", handler);
}
return pipeline;
}
示例5: connect
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
/**
* Starts the BGP peer.
*
* @param connectToSocket the socket to connect to
*/
private void connect(InetSocketAddress connectToSocket)
throws InterruptedException {
ChannelFactory channelFactory =
new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
ChannelPipelineFactory pipelineFactory = () -> {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("BgpPeerFrameDecoderTest",
peerFrameDecoder);
pipeline.addLast("BgpPeerChannelHandlerTest",
peerChannelHandler);
return pipeline;
};
peerBootstrap = new ClientBootstrap(channelFactory);
peerBootstrap.setOption("child.keepAlive", true);
peerBootstrap.setOption("child.tcpNoDelay", true);
peerBootstrap.setPipelineFactory(pipelineFactory);
peerBootstrap.connect(connectToSocket);
}
示例6: connectFrom
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
private Channel connectFrom(InetSocketAddress connectToSocket, SocketAddress localAddress)
throws InterruptedException {
ChannelFactory channelFactory =
new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
ChannelPipelineFactory pipelineFactory = () -> {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("BgpPeerFrameDecoderTest",
peerFrameDecoder);
pipeline.addLast("BgpPeerChannelHandlerTest",
peerChannelHandler);
return pipeline;
};
peerBootstrap = new ClientBootstrap(channelFactory);
peerBootstrap.setOption("child.keepAlive", true);
peerBootstrap.setOption("child.tcpNoDelay", true);
peerBootstrap.setPipelineFactory(pipelineFactory);
Channel channel = peerBootstrap.connect(connectToSocket, localAddress).getChannel();
return channel;
}
示例7: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
RemoteSyncChannelHandler channelHandler =
new RemoteSyncChannelHandler(syncManager);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("frameDecoder",
new ThriftFrameDecoder(maxFrameSize));
pipeline.addLast("frameEncoder",
new ThriftFrameEncoder());
pipeline.addLast("timeout",
new RSHandshakeTimeoutHandler(channelHandler,
timer, 3));
pipeline.addLast("handler", channelHandler);
return pipeline;
}
示例8: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
RPCChannelHandler channelHandler =
new RPCChannelHandler(syncManager, rpcService);
IdleStateHandler idleHandler =
new IdleStateHandler(timer, 5, 10, 0);
ReadTimeoutHandler readTimeoutHandler =
new ReadTimeoutHandler(timer, 30);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("idle", idleHandler);
pipeline.addLast("timeout", readTimeoutHandler);
pipeline.addLast("handshaketimeout",
new HandshakeTimeoutHandler(channelHandler, timer, 10));
pipeline.addLast("frameDecoder",
new ThriftFrameDecoder(maxFrameSize));
pipeline.addLast("frameEncoder",
new ThriftFrameEncoder());
pipeline.addLast("handler", channelHandler);
return pipeline;
}
示例9: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
OFChannelHandler handler = new OFChannelHandler(controller);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("ofmessagedecoder", new OFMessageDecoder());
pipeline.addLast("ofmessageencoder", new OFMessageEncoder());
pipeline.addLast("idle", idleHandler);
pipeline.addLast("timeout", readTimeoutHandler);
pipeline.addLast("handshaketimeout",
new HandshakeTimeoutHandler(handler, timer, 15));
if (pipelineExecutor != null)
pipeline.addLast("pipelineExecutor",
new ExecutionHandler(pipelineExecutor));
pipeline.addLast("handler", handler);
return pipeline;
}
示例10: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
// Create a default pipeline implementation.
ChannelPipeline pipeline = Channels.pipeline();
SslHandler sslHandler = configureServerSSLOnDemand();
if (sslHandler != null) {
LOG.debug("Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler);
pipeline.addLast("ssl", sslHandler);
}
pipeline.addLast("decoder", new HttpRequestDecoder(4096, configuration.getMaxHeaderSize(), 8192));
if (configuration.isChunked()) {
pipeline.addLast("aggregator", new HttpChunkAggregator(configuration.getChunkedMaxContentLength()));
}
pipeline.addLast("encoder", new HttpResponseEncoder());
if (configuration.isCompression()) {
pipeline.addLast("deflater", new HttpContentCompressor());
}
pipeline.addLast("handler", channelFactory.getChannelHandler());
return pipeline;
}
示例11: getPipelineFactory
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
public ChannelPipelineFactory getPipelineFactory() {
executionHandler = new NaviExecutionHandler();
// execution = new ExecutionHandler(Executors.newCachedThreadPool());
return new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("idleState", new IdleStateHandler(timer,
getChildChannelIdleTime(), getChildChannelIdleTime(),
getChildChannelIdleTime()));
//StateCheckChannelHandler加入心跳机制 读空闲 断开连接 写空闲发送心跳数据
// pipeline.addLast("idleHandler", new StateCheckChannelHandler());
pipeline.addLast("decoder", new DelimiterBasedFrameDecoder(getMaxPacketSize(), getDelimiter()));
pipeline.addLast("execution", executionHandler);
// pipeline.addLast("execution", execution);
pipeline.addLast("handler", getNaviTCPHandler());
return pipeline;
}
};
}
示例12: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
RemoteRequestHandler remoteRequestHandler = new RemoteRequestHandler();
remoteRequestHandler.setSettings(settings);
remoteRequestHandler.setApplicationContext(applicationContext);
ChannelPipeline pipeline = Channels.pipeline();
if (settings.getKeepAliveTimeout() > 0) {
pipeline.addLast("idle", new IdleStateHandler(timer, 0, 0, settings.getKeepAliveTimeout()));
pipeline.addLast("timeout", httpTimeoutHandler);
}
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("handler", remoteRequestHandler);
return pipeline;
}
示例13: getPipelineFactory
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipelineFactory getPipelineFactory() {
executionHandler = new NaviExecutionHandler();
return new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("httpCodec", new NaviHttpServerCodec());
pipeline.addLast("inflater", new HttpContentDecompressor());
pipeline.addLast("GLOBAL_TRAFFIC_SHAPING", globalTcHandler);
String chunkSize = ServerConfigure.get(NaviDefine.CHUNK_AGGR_SIZE);
if (StringUtils.isNumeric(chunkSize)) {
pipeline.addLast("aggregator", new HttpChunkAggregator(Integer.valueOf(chunkSize)));
}
// pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("deflater", new HttpContentCompressor());
pipeline.addLast("execution", executionHandler);
pipeline.addLast("idleState", new IdleStateHandler(timer, getChildChannelIdleTime(), getChildChannelIdleTime(), getChildChannelIdleTime()));
pipeline.addLast("handler", getNaviHttpHandler());
return pipeline;
}
};
}
示例14: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
OFChannelState state = new OFChannelState();
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("ofmessagedecoder", new OFMessageDecoder());
pipeline.addLast("ofmessageencoder", new OFMessageEncoder());
pipeline.addLast("idle", idleHandler);
pipeline.addLast("timeout", readTimeoutHandler);
pipeline.addLast("handshaketimeout",
new HandshakeTimeoutHandler(state, timer, 15));
if (pipelineExecutor != null)
pipeline.addLast("pipelineExecutor",
new ExecutionHandler(pipelineExecutor));
pipeline.addLast("handler", controller.getChannelHandler(state));
return pipeline;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:18,代码来源:OpenflowPipelineFactory.java
示例15: getPipeline
import org.jboss.netty.channel.Channels; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
if (sslFactory != null) {
pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine()));
}
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16));
pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("chunking", new ChunkedWriteHandler());
pipeline.addLast("shuffle", SHUFFLE);
pipeline.addLast("idle", idleStateHandler);
pipeline.addLast(TIMEOUT_HANDLER, new TimeoutHandler());
return pipeline;
// TODO factor security manager into pipeline
// TODO factor out encode/decode to permit binary shuffle
// TODO factor out decode of index to permit alt. models
}