翻mina的源代码的时候,在NioProcessor里面居然看到这么个方法:
@Override
protected int read(NioSession session, IoBuffer buf) throws Exception {
ByteChannel channel = session.getChannel();
return session.getChannel().read(buf.buf());
}
也不知道这哥们咋想的,设置一个channel的引用,然后让它在那里闲的没事干。和应用里if(){}else{......}这样的代码一样看起来可乐