本文整理汇总了Java中org.jboss.netty.bootstrap.ConnectionlessBootstrap类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionlessBootstrap类的具体用法?Java ConnectionlessBootstrap怎么用?Java ConnectionlessBootstrap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionlessBootstrap类属于org.jboss.netty.bootstrap包,在下文中一共展示了ConnectionlessBootstrap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new CellocatorFrameDecoder());
pipeline.addLast("objectEncoder", new CellocatorProtocolEncoder());
pipeline.addLast("objectDecoder", new CellocatorProtocolDecoder(CellocatorProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectEncoder", new CellocatorProtocolEncoder());
pipeline.addLast("objectDecoder", new CellocatorProtocolDecoder(CellocatorProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:24,代码来源:CellocatorProtocol.java
示例2: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new MeitrackFrameDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:25,代码来源:MeitrackProtocol.java
示例3: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0));
pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:22,代码来源:CastelProtocol.java
示例4: TrackerServer
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
public TrackerServer(Bootstrap bootstrap, String protocol) {
this.bootstrap = bootstrap;
this.protocol = protocol;
if (bootstrap instanceof ServerBootstrap) {
bootstrap.setFactory(GlobalChannelFactory.getFactory());
} else if (bootstrap instanceof ConnectionlessBootstrap) {
bootstrap.setFactory(GlobalChannelFactory.getDatagramFactory());
}
address = Context.getConfig().getString(protocol + ".address");
port = Context.getConfig().getInteger(protocol + ".port");
bootstrap.setPipelineFactory(new BasePipelineFactory(this, protocol) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
TrackerServer.this.addSpecificHandlers(pipeline);
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:21,代码来源:TrackerServer.java
示例5: run
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
public void run() {
// Configure the client.
DatagramChannelFactory f = new NioDatagramChannelFactory(
Executors.newCachedThreadPool(), workerCount);
server = new ConnectionlessBootstrap(f);
server.setPipeline(Channels.pipeline(RpcUtil.STAGE_RPC_MESSAGE_PARSER,
rpcProgram, RpcUtil.STAGE_RPC_UDP_RESPONSE));
server.setOption("broadcast", "false");
server.setOption("sendBufferSize", SEND_BUFFER_SIZE);
server.setOption("receiveBufferSize", RECEIVE_BUFFER_SIZE);
// Listen to the UDP port
ch = server.bind(new InetSocketAddress(port));
InetSocketAddress socketAddr = (InetSocketAddress) ch.getLocalAddress();
boundPort = socketAddr.getPort();
LOG.info("Started listening to UDP requests at port " + boundPort + " for "
+ rpcProgram + " with workerCount " + workerCount);
}
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:SimpleUdpServer.java
示例6: run
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
public void run() {
// Configure the client.
DatagramChannelFactory f = new NioDatagramChannelFactory(
Executors.newCachedThreadPool(), workerCount);
ConnectionlessBootstrap b = new ConnectionlessBootstrap(f);
b.setPipeline(Channels.pipeline(
RpcUtil.STAGE_RPC_MESSAGE_PARSER, rpcProgram,
RpcUtil.STAGE_RPC_UDP_RESPONSE));
b.setOption("broadcast", "false");
b.setOption("sendBufferSize", SEND_BUFFER_SIZE);
b.setOption("receiveBufferSize", RECEIVE_BUFFER_SIZE);
// Listen to the UDP port
Channel ch = b.bind(new InetSocketAddress(port));
InetSocketAddress socketAddr = (InetSocketAddress) ch.getLocalAddress();
boundPort = socketAddr.getPort();
LOG.info("Started listening to UDP requests at port " + boundPort + " for "
+ rpcProgram + " with workerCount " + workerCount);
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:23,代码来源:SimpleUdpServer.java
示例7: run
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
public void run() {
// Configure the client.
DatagramChannelFactory f = new NioDatagramChannelFactory(
Executors.newCachedThreadPool(), workerCount);
ConnectionlessBootstrap b = new ConnectionlessBootstrap(f);
ChannelPipeline p = b.getPipeline();
p.addLast("handler", new SimpleUdpServerHandler(rpcProgram));
b.setOption("broadcast", "false");
b.setOption("sendBufferSize", SEND_BUFFER_SIZE);
b.setOption("receiveBufferSize", RECEIVE_BUFFER_SIZE);
// Listen to the UDP port
b.bind(new InetSocketAddress(port));
LOG.info("Started listening to UDP requests at port " + port + " for "
+ rpcProgram + " with workerCount " + workerCount);
}
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:20,代码来源:SimpleUdpServer.java
示例8: TrackerServer
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
public TrackerServer(ServerManager serverManager, Bootstrap bootstrap, String protocol) {
this.serverManager = serverManager;
this.bootstrap = bootstrap;
this.protocol = protocol;
// Set appropriate channel factory
if (bootstrap instanceof ServerBootstrap) {
bootstrap.setFactory(GlobalChannelFactory.getFactory());
} else if (bootstrap instanceof ConnectionlessBootstrap) {
bootstrap.setFactory(GlobalChannelFactory.getDatagramFactory());
}
address = serverManager.getProperties().getProperty(protocol + ".address");
String portProperty = serverManager.getProperties().getProperty(protocol + ".port");
port = (portProperty != null) ? Integer.valueOf(portProperty) : 5000;
bootstrap.setPipelineFactory(new BasePipelineFactory(serverManager, this, protocol) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
TrackerServer.this.addSpecificHandlers(pipeline);
}
});
}
开发者ID:michaelloliveira,项目名称:traccar-mongodb,代码行数:24,代码来源:TrackerServer.java
示例9: start
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
/**
* Start server
*/
public void start() {
InetSocketAddress endpoint;
if (address == null) {
endpoint = new InetSocketAddress(port);
} else {
endpoint = new InetSocketAddress(address, port);
}
Channel channel = null;
if (bootstrap instanceof ServerBootstrap) {
channel = ((ServerBootstrap) bootstrap).bind(endpoint);
} else if (bootstrap instanceof ConnectionlessBootstrap) {
channel = ((ConnectionlessBootstrap) bootstrap).bind(endpoint);
}
if (channel != null) {
getChannelGroup().add(channel);
}
}
开发者ID:michaelloliveira,项目名称:traccar-mongodb,代码行数:23,代码来源:TrackerServer.java
示例10: run
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
public void run() {
// Configure the client.
DatagramChannelFactory f = new NioDatagramChannelFactory(
Executors.newCachedThreadPool(), workerCount);
ConnectionlessBootstrap b = new ConnectionlessBootstrap(f);
b.setPipeline(Channels.pipeline(
RpcUtil.STAGE_RPC_MESSAGE_PARSER, rpcProgram,
RpcUtil.STAGE_RPC_UDP_RESPONSE));
b.setOption("broadcast", "false");
b.setOption("sendBufferSize", SEND_BUFFER_SIZE);
b.setOption("receiveBufferSize", RECEIVE_BUFFER_SIZE);
// Listen to the UDP port
b.bind(new InetSocketAddress(port));
LOG.info("Started listening to UDP requests at port " + port + " for "
+ rpcProgram + " with workerCount " + workerCount);
}
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:21,代码来源:SimpleUdpServer.java
示例11: createUdpServer
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
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;
}
开发者ID:naver,项目名称:pinpoint,代码行数:25,代码来源:NettyUdpReceiverTest.java
示例12: start
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void start() {
// setup Netty server
ConnectionlessBootstrap serverBootstrap = new ConnectionlessBootstrap(
new OioDatagramChannelFactory(Executors.newCachedThreadPool()));
final syslogHandler handler = new syslogHandler();
handler.setFormater(formaterProp);
handler.setKeepFields(keepFields);
serverBootstrap.setOption("receiveBufferSizePredictorFactory",
new AdaptiveReceiveBufferSizePredictorFactory(DEFAULT_MIN_SIZE,
DEFAULT_INITIAL_SIZE, maxsize));
serverBootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() {
return Channels.pipeline(handler);
}
});
if (host == null) {
nettyChannel = serverBootstrap.bind(new InetSocketAddress(port));
} else {
nettyChannel = serverBootstrap.bind(new InetSocketAddress(host, port));
}
sourceCounter.start();
super.start();
}
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:28,代码来源:SyslogUDPSource.java
示例13: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new SkypatrolProtocolDecoder(SkypatrolProtocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:10,代码来源:SkypatrolProtocol.java
示例14: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new HomtecsProtocolDecoder(HomtecsProtocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:12,代码来源:HomtecsProtocol.java
示例15: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new Xt2400ProtocolDecoder(Xt2400Protocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:10,代码来源:Xt2400Protocol.java
示例16: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new TytanProtocolDecoder(TytanProtocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:10,代码来源:TytanProtocol.java
示例17: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectDecoder", new AisProtocolDecoder(AisProtocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:11,代码来源:AisProtocol.java
示例18: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new OigoProtocolDecoder(OigoProtocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:10,代码来源:OigoProtocol.java
示例19: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new SmokeyProtocolDecoder(SmokeyProtocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:10,代码来源:SmokeyProtocol.java
示例20: initTrackerServers
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; //导入依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new CalAmpProtocolDecoder(CalAmpProtocol.this));
}
});
}
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:10,代码来源:CalAmpProtocol.java
注:本文中的org.jboss.netty.bootstrap.ConnectionlessBootstrap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论