English 中文(简体)
使用 Netty 的 Java 客户端端对多端用户端
原标题:Java client peer-to-multipeer using Netty

我写下一个过程, 它必须连接(并维持生命)到数个(百个)边远的同龄人, 并管理信息/控制他们。

我制作了两个版本的软件:第一个是经典的“全线连接”模型,第二个是标准 java NIO 和选择器(减少线条分配,但有问题 ) 。 然后,我环顾四周发现Netty在多数情况下可以增加很多,我开始使用第三个软件。 我的目标是保持资源使用率相当低,保持速度。

Once written the pipeline factory with custom events and dynamic handler switching, I stopped on the most superficial part: its allocation. All the examples I read use a single client with single connection, so I got the doubt: I set up a ChannelFactory and a PipelineFactory, so every (new ClientBootstrap(factory)).connect(address) makes a new channel with a new pipeline. Is it possible to make a shared pipeline and defer business logic to a thread-pool? If so, how?

使用标准 java NIO I, 利用选择器, 利用两个小型小线条池( 线条 & lt; 远程对等器) ; 然而, 回收读取听觉频道写作时遇到了麻烦 。

通信应当通过单一的频道进行,该频道可以接收远程对等点的定时信息或进行三向控制(指令-ack-ok)。

第二手:一旦事件到达最后一个处理者,会怎样?是在那里我提取它还是我可以从任何一点提取信息?

最佳回答

你只应该有一个靴子(即一个频道装置和一个管道装置 ) 。 管道,甚至单个频道操作器,可以共享,但通常每个频道都独有。

你可以在输油管里有一个执行手 将行刑从IO的工人线 转移到一个线池

但是,你为什么不在http://netty.io/wiki/ 上读读详尽的文件?你会找到你所问问题的答案。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签