本文整理汇总了Java中org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory类的典型用法代码示例。如果您正苦于以下问题:Java FixedReceiveBufferSizePredictorFactory类的具体用法?Java FixedReceiveBufferSizePredictorFactory怎么用?Java FixedReceiveBufferSizePredictorFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FixedReceiveBufferSizePredictorFactory类属于org.jboss.netty.channel包,在下文中一共展示了FixedReceiveBufferSizePredictorFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initConnection
import org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory; //导入依赖的package包/类
/**
* Initializes the netty client channel connection.
*/
private void initConnection() {
if (peerBootstrap != null) {
return;
}
peerBootstrap = createPeerBootStrap();
peerBootstrap.setOption("reuseAddress", true);
peerBootstrap.setOption("tcpNoDelay", true);
peerBootstrap.setOption("keepAlive", true);
peerBootstrap.setOption("receiveBufferSize", Controller.BUFFER_SIZE);
peerBootstrap.setOption("receiveBufferSizePredictorFactory",
new FixedReceiveBufferSizePredictorFactory(
Controller.BUFFER_SIZE));
peerBootstrap.setOption("receiveBufferSizePredictor",
new AdaptiveReceiveBufferSizePredictor(64, 4096, 65536));
peerBootstrap.setOption("child.keepAlive", true);
peerBootstrap.setOption("child.tcpNoDelay", true);
peerBootstrap.setOption("child.sendBufferSize", Controller.BUFFER_SIZE);
peerBootstrap.setOption("child.receiveBufferSize", Controller.BUFFER_SIZE);
peerBootstrap.setOption("child.receiveBufferSizePredictorFactory",
new FixedReceiveBufferSizePredictorFactory(
Controller.BUFFER_SIZE));
peerBootstrap.setOption("child.reuseAddress", true);
ospfChannelHandler = new OspfInterfaceChannelHandler(this, processes);
ChannelPipelineFactory pfact = new OspfPipelineFactory(ospfChannelHandler);
peerBootstrap.setPipelineFactory(pfact);
}
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:Controller.java
示例2: initConnection
import org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory; //导入依赖的package包/类
/**
* Initializes the netty client channel connection.
*/
private void initConnection() {
if (peerBootstrap != null) {
return;
}
peerBootstrap = createPeerBootStrap();
peerBootstrap.setOption("reuseAddress", true);
peerBootstrap.setOption("tcpNoDelay", true);
peerBootstrap.setOption("keepAlive", true);
peerBootstrap.setOption("receiveBufferSize", Controller.BUFFER_SIZE);
peerBootstrap.setOption("receiveBufferSizePredictorFactory",
new FixedReceiveBufferSizePredictorFactory(
Controller.BUFFER_SIZE));
peerBootstrap.setOption("receiveBufferSizePredictor",
new AdaptiveReceiveBufferSizePredictor(64, 1024, 65536));
peerBootstrap.setOption("child.keepAlive", true);
peerBootstrap.setOption("child.tcpNoDelay", true);
peerBootstrap.setOption("child.sendBufferSize", Controller.BUFFER_SIZE);
peerBootstrap.setOption("child.receiveBufferSize", Controller.BUFFER_SIZE);
peerBootstrap.setOption("child.receiveBufferSizePredictorFactory",
new FixedReceiveBufferSizePredictorFactory(
Controller.BUFFER_SIZE));
peerBootstrap.setOption("child.reuseAddress", true);
isisChannelHandler = new IsisChannelHandler(this, processes);
ChannelPipelineFactory pfact = new IsisPipelineFactory(isisChannelHandler);
peerBootstrap.setPipelineFactory(pfact);
}
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:Controller.java
示例3: startServerBootstrap
import org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory; //导入依赖的package包/类
protected void startServerBootstrap() throws Exception {
// create non-shared worker pool
int count = configuration.getWorkerCount() > 0 ? configuration.getWorkerCount() : NettyHelper.DEFAULT_IO_THREADS;
workerPool = new NioDatagramWorkerPool(Executors.newCachedThreadPool(), count);
datagramChannelFactory = new NioDatagramChannelFactory(workerPool);
connectionlessBootstrap = new ConnectionlessBootstrap(datagramChannelFactory);
connectionlessBootstrap.setOption("child.keepAlive", configuration.isKeepAlive());
connectionlessBootstrap.setOption("child.tcpNoDelay", configuration.isTcpNoDelay());
connectionlessBootstrap.setOption("reuseAddress", configuration.isReuseAddress());
connectionlessBootstrap.setOption("child.reuseAddress", configuration.isReuseAddress());
connectionlessBootstrap.setOption("child.connectTimeoutMillis", configuration.getConnectTimeout());
connectionlessBootstrap.setOption("child.broadcast", configuration.isBroadcast());
connectionlessBootstrap.setOption("sendBufferSize", configuration.getSendBufferSize());
connectionlessBootstrap.setOption("receiveBufferSize", configuration.getReceiveBufferSize());
// only set this if user has specified
if (configuration.getReceiveBufferSizePredictor() > 0) {
connectionlessBootstrap.setOption("receiveBufferSizePredictorFactory",
new FixedReceiveBufferSizePredictorFactory(configuration.getReceiveBufferSizePredictor()));
}
if (configuration.getBacklog() > 0) {
connectionlessBootstrap.setOption("backlog", configuration.getBacklog());
}
// set any additional netty options
if (configuration.getOptions() != null) {
for (Map.Entry<String, Object> entry : configuration.getOptions().entrySet()) {
connectionlessBootstrap.setOption(entry.getKey(), entry.getValue());
}
}
LOG.debug("Created ConnectionlessBootstrap {} with options: {}", connectionlessBootstrap, connectionlessBootstrap.getOptions());
// set the pipeline factory, which creates the pipeline for each newly created channels
connectionlessBootstrap.setPipelineFactory(pipelineFactory);
InetSocketAddress hostAddress = new InetSocketAddress(configuration.getHost(), configuration.getPort());
IpV4Subnet multicastSubnet = new IpV4Subnet(MULTICAST_SUBNET);
if (multicastSubnet.contains(configuration.getHost())) {
datagramChannel = (DatagramChannel)connectionlessBootstrap.bind(hostAddress);
String networkInterface = configuration.getNetworkInterface() == null ? LOOPBACK_INTERFACE : configuration.getNetworkInterface();
multicastNetworkInterface = NetworkInterface.getByName(networkInterface);
ObjectHelper.notNull(multicastNetworkInterface, "No network interface found for '" + networkInterface + "'.");
LOG.info("ConnectionlessBootstrap joining {}:{} using network interface: {}", new Object[]{configuration.getHost(), configuration.getPort(), multicastNetworkInterface.getName()});
datagramChannel.joinGroup(hostAddress, multicastNetworkInterface).syncUninterruptibly();
allChannels.add(datagramChannel);
} else {
LOG.info("ConnectionlessBootstrap binding to {}:{}", configuration.getHost(), configuration.getPort());
channel = connectionlessBootstrap.bind(hostAddress);
allChannels.add(channel);
}
}
开发者ID:HydAu,项目名称:Camel,代码行数:55,代码来源:SingleUDPNettyServerBootstrapFactory.java
示例4: doStart
import org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory; //导入依赖的package包/类
public void doStart()
{
Log.info("RayoComponent initialize " + jid);
XMPPServer server = XMPPServer.getInstance();
server.getIQDiscoInfoHandler().addServerFeature(RAYO_CORE);
rayoProvider = new RayoProvider();
rayoProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_RECORD);
recordProvider = new RecordProvider();
recordProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_SAY);
sayProvider = new SayProvider();
sayProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_HANDSET);
handsetProvider = new HandsetProvider();
handsetProvider.setValidator(new Validator());
createIQHandlers();
try{
Log.info("Starting jCumulus.....");
sessions = new Sessions();
ExecutorService executorservice = Executors.newCachedThreadPool();
NioDatagramChannelFactory niodatagramchannelfactory = new NioDatagramChannelFactory(executorservice);
bootstrap = new ConnectionlessBootstrap(niodatagramchannelfactory);
OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor = new OrderedMemoryAwareThreadPoolExecutor(10, 0x100000L, 0x40000000L, 100L, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory());
bootstrap.setPipelineFactory(new ServerPipelineFactory(sessions, orderedmemoryawarethreadpoolexecutor));
bootstrap.setOption("reuseAddress", Boolean.valueOf(true));
bootstrap.setOption("sendBufferSize", Integer.valueOf(1215));
bootstrap.setOption("receiveBufferSize", Integer.valueOf(2048));
bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(2048));
InetSocketAddress inetsocketaddress = new InetSocketAddress(JiveGlobals.getIntProperty("voicebridge.rtmfp.port", 1935));
Log.info("Listening on " + inetsocketaddress.getPort() + " port");
channel = bootstrap.bind(inetsocketaddress);
} catch (Exception e) {
Log.error("jCumulus startup failure");
e.printStackTrace();
}
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:51,代码来源:RayoComponent.java
示例5: doStart
import org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory; //导入依赖的package包/类
public void doStart()
{
Log.info("RayoComponent initialize " + jid);
XMPPServer server = XMPPServer.getInstance();
server.getIQDiscoInfoHandler().addServerFeature(RAYO_CORE);
rayoProvider = new RayoProvider();
rayoProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_RECORD);
recordProvider = new RecordProvider();
recordProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_SAY);
sayProvider = new SayProvider();
sayProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_HANDSET);
handsetProvider = new HandsetProvider();
handsetProvider.setValidator(new Validator());
createIQHandlers();
try{
Log.info("Starting jCumulus.....");
sessions = new Sessions();
ExecutorService executorservice = Executors.newCachedThreadPool();
NioDatagramChannelFactory niodatagramchannelfactory = new NioDatagramChannelFactory(executorservice);
bootstrap = new ConnectionlessBootstrap(niodatagramchannelfactory);
OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor = new OrderedMemoryAwareThreadPoolExecutor(10, 0x100000L, 0x40000000L, 100L, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory());
bootstrap.setPipelineFactory(new ServerPipelineFactory(sessions, orderedmemoryawarethreadpoolexecutor));
bootstrap.setOption("reuseAddress", Boolean.valueOf(true));
bootstrap.setOption("sendBufferSize", Integer.valueOf(1215));
bootstrap.setOption("receiveBufferSize", Integer.valueOf(2048));
bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(2048));
InetSocketAddress inetsocketaddress = new InetSocketAddress(JiveGlobals.getIntProperty("voicebridge.rtmfp.port", 1935));
Log.info("Listening on " + inetsocketaddress.getPort() + " port");
channel = bootstrap.bind(inetsocketaddress);
} catch (Exception e) {
Log.error("jCumulus startup failure");
e.printStackTrace();
}
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:51,代码来源:RayoComponent.java
注:本文中的org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论