简体   繁体   English

Java非阻塞通道,选择器和interestOps

[英]Java Non-blocking channels, Selector and interestOps

When I get OP_CONNECT event I call finishConnect() and update interestOps: 当我收到OP_CONNECT事件时,我调用finishConnect()并更新interestOps:

key.interestOps(key.interestOps() & ~SelectionKey.OP_CONNECT | SelectionKey.OP_READ);

But in a next iteration(selector.select(..)) I again get OP_CONNECT event, although key.interestOps does not contain OP_CONNECT event. 但是在下一次迭代中(selector.select(..)),我再次得到OP_CONNECT事件,尽管key.interestOps不包含OP_CONNECT事件。 What am I doing wrong? 我究竟做错了什么?

因此,我所需要的-它是从一组selectedKeys中删除使用过的SelectionKey的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM