本文整理匯總了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
}