use of org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory in project Openfire by igniterealtime.
the class RayoComponent method doStart.
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();
}
}
use of org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory in project pinpoint by naver.
the class NettyUdpReceiverTest method createUdpServer.
private ConnectionlessBootstrap createUdpServer() {
DatagramChannelFactory udpFactory = new NioDatagramChannelFactory(Executors.newCachedThreadPool(), 4);
ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("test", new SimpleChannelHandler() {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
String name = Thread.currentThread().getName();
logger.debug("sleep:{}", name);
Thread.sleep(10000);
// if (!name.equals("New I/O worker #1")) {
logger.debug("messageReceived thread-{} message:", Thread.currentThread().getName());
// }
}
});
return pipeline;
}
};
ConnectionlessBootstrap udpBootstrap = new ConnectionlessBootstrap(udpFactory);
udpBootstrap.setPipelineFactory(pipelineFactory);
return udpBootstrap;
}
use of org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory in project graylog2-server by Graylog2.
the class UdpTransport method getBootstrap.
@Override
public Bootstrap getBootstrap() {
final ConnectionlessBootstrap bootstrap = new ConnectionlessBootstrap(new NioDatagramChannelFactory(workerExecutor));
final int recvBufferSize = Ints.saturatedCast(getRecvBufferSize());
LOG.debug("Setting receive buffer size to {} bytes", recvBufferSize);
bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(recvBufferSize));
bootstrap.setOption("receiveBufferSize", recvBufferSize);
return bootstrap;
}
use of org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory in project camel by apache.
the class NettyUdpConnectedSendTest method createNettyUdpReceiver.
public void createNettyUdpReceiver() {
bootstrap = new ConnectionlessBootstrap(new NioDatagramChannelFactory());
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline channelPipeline = Channels.pipeline();
channelPipeline.addLast("StringDecoder", new StringDecoder(CharsetUtil.UTF_8));
channelPipeline.addLast("ContentHandler", new ContentHandler());
return channelPipeline;
}
});
}
use of org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory in project camel by apache.
the class NettyProducer method setupUDPCommunication.
protected void setupUDPCommunication() throws Exception {
if (datagramChannelFactory == null) {
int count = configuration.getWorkerCount() > 0 ? configuration.getWorkerCount() : NettyHelper.DEFAULT_IO_THREADS;
workerPool = new NioDatagramWorkerPool(Executors.newCachedThreadPool(), count);
datagramChannelFactory = new NioDatagramChannelFactory(workerPool);
}
}
Aggregations