Le Wed, 04 Mar 2009 21:34:11 +0800, houzhanbin <[email protected]> a écrit :
> hi,developers,
> I find an duplicate code in NioProcessor.java, I think they do the
> same thing.
>
> (1)
> protected boolean isInterestedInRead(NioSession session) {
> SelectionKey key = session.getSelectionKey();
> return key.isValid() && (key.interestOps() &
> SelectionKey.OP_READ) != 0;
> }
> (2)
> protected boolean isReadable(NioSession session) {
> SelectionKey key = session.getSelectionKey();
> return key.isValid() && key.isReadable();
> }
> the code comes from mina-2.0.0-M4
> thanks for your reply..
>
> Houzhanbin
key.isReadable() is the same as "k.readyOps() & OP_READ != 0"
it's testing ready ops and not interested in ops.
It's pretty confusing code, but not the same for me.
Julien
signature.asc
Description: PGP signature
