2

in netty ( http://www.Netty.io ) framework , class pathway of org.jboss.netty.channel.Channel have some fields for InterestOps (OP_NONE,OP_READ,OP_READ_WRITE,OP_WRITE)
these details of fields there are in javadoc
link : http://netty.io/3.9/api/org/jboss/netty/channel/Channel.html

OP_READ - If set, a message sent by a remote peer will be read immediately. If unset, the message from the remote peer will not be read until the OP_READ flag is set again (i.e. read suspension).
OP_WRITE - If set, a write request will not be sent to a remote peer until the OP_WRITE flag is cleared and the write request will be pending in a queue. If unset, the write request will be flushed out as soon as possible from the queue.
OP_READ_WRITE - This is a combination of OP_READ and OP_WRITE, which means only write requests are suspended.
OP_NONE - This is a combination of (NOT OP_READ) and (NOT OP_WRITE), which means only read operation is suspended.

first explains are OK and logical but this fields explain again in Field Summary section :

OP_NONE The interestOps value which tells that only read operation has been suspended.
OP_READ The interestOps value which tells that neither read nor write operation has been suspended.
OP_READ_WRITE The interestOps value which tells that only write operation has been suspended.
OP_WRITE The interestOps value which tells that both read and write operation has been suspended.

i think all second explain is not match with all first explain , is this a type wrong or it's logical ??

2
  • None of it makes any sense to me whatsoever, but I'm no Netty expert, or fan. You can rely on the Javadoc for OP_READ and OP_WRITE, at least in this case. Commented Dec 23, 2013 at 9:11
  • Your edit makes even less sense than your original question. Commented Dec 26, 2013 at 9:51

1 Answer 1

0

to my understanding, both descriptions do match and are correct.

there are two main flags - read flag and write flag. from the Channel interface in netty sources it can be seen that the read flag is the 1st least significant bit of the interestOps value and the write flag is the 3rd least significant bit of the interestOps value.

if the read flag is set, then read operations are not suspended.

if the write flag is set, then write operations are suspended.

all the interestOps values which are described deal with if the channel's read or write flags are set and their names reflect the flags state, not the operations suspension state.

  • OP_READ - the value name indicates that only the read flag is set (netty sources shows that OP_READ = 1). since the read flag is set, read operation are not suspended. since the write flag is not set, write operation are not suspended. this is the actual read flag mask, and this is why it regarded in the first javaDoc description as the actual flag.

  • OP_WRITE - the value name indicates that only the write flag is set (netty sources shows that OP_READ = 4). since the write flag is set, write operations are suspended. since the read flag is not set, read operations are suspended. this is the actual write flag mask, and this is why it regarded in the first javaDoc description as the actual flag.

  • OP_READ_WRITE - the value name indicates that both read and write flags are set (netty sources shows that OP_READ_WRITE = OP_READ | OP_WRITE = 5). since the read flag is set, read operation are not suspended. since the write flag is set, write operations are suspended.

  • OP_NONE - the value name indicates that no flag is set (netty sources shows that OP_NONE = 0). since the read flag is not set, read operations are suspended. since the write flag is not set, write operation are not suspended.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.