我根据OneConnector示例创建了一个简单的嵌入式jetty项目。
当我开始这个示例时,我看到一个TCP连接处于侦听状态,这是我希望看到的。在已建立的状态中也有相当多的TCP连接。
他们为什么在那里,为什么有这么多,他们是用来做什么的?
在TCPView中,我看到以下连接:
java.exe:14536 TCP my-pc:8080 my-pc.tfs.attix5.com:0 LISTENING
java.exe:14536 TCP my-pc:56791 localhost:56792 ESTABLISHED
java.exe:14536 TCP my-pc:56792 localhost:56791 ESTABLISHED
java.exe:14536 TCP my-pc:56793 localhost:56794 ESTABLISHED
java.exe:14536 TCP my-pc:56794 localhost:56793 ESTABLISHED
java.exe:14536 TCP my-pc:56795 localhost:56796 ESTABLISHED
java.exe:14536 TCP my-pc:56796 localhost:56795 ESTABLISHED
java.exe:14536 TCP my-pc:56797 localhost:56798 ESTABLISHED
java.exe:14536 TCP my-pc:56798 localhost:56797 ESTABLISHED
java.exe:14536 TCP my-pc:56799 localhost:56800 ESTABLISHED
java.exe:14536 TCP my-pc:56800 localhost:56799 ESTABLISHED
java.exe:14536 TCP my-pc:56801 localhost:56802 ESTABLISHED
java.exe:14536 TCP my-pc:56802 localhost:56801 ESTABLISHED
java.exe:14536 TCP my-pc:56803 localhost:56804 ESTABLISHED
java.exe:14536 TCP my-pc:56804 localhost:56803 ESTABLISHED
java.exe:14536 TCP my-pc:56805 localhost:56806 ESTABLISHED
java.exe:14536 TCP my-pc:56806 localhost:56805 ESTABLISHED 发布于 2014-08-05 12:46:22
在源代码中,默认情况下是这样的.
_manager = new ServerConnectorManager(
getExecutor(),
getScheduler(),
selectors>0?
selectors:
Math.max(1,Math.min(4,Runtime.getRuntime().availableProcessors()/2)
));
addBean(_manager, true);这证明了,这是基于处理器的数量,你拥有的是与默认启动的选择器的数量相关的。
https://stackoverflow.com/questions/18610381
复制相似问题