jeromq
jeromq copied to clipboard
Strange l
I found a strange test in https://github.com/zeromq/jeromq/blob/d2121cf3293862b9ce8e5c6f85bb586ea21328d0/src/main/java/org/zeromq/ZMonitor.java#L99:
The whole function is:
private static Event find(int event)
{
for (Event candidate : Event.values()) {
if ((candidate.events & event) != 0) {
return candidate;
}
}
// never arrives here, but anyway...
return ALL;
}
}
What event is expected to be ? If it's a mask, as the test (candidate.events & event) != 0) implies, many values can fit. It's a single value, why bother with a binary and, an == will do the job ?
I would check czmq, it's likely this was based of something in there
My comprehension is that org.zeromq is for java-native code, not ported from czmq. There is no ZMonitor in libzmq.
jeromq is a mashup of both IMHO. Anything prefixed with a Z, the idea/interface most likely came from czmq
I don't remember this particular test coming from czmq. Maybe I was overcautious. Feel free to change it back.
But yes, zmq package carries the java equivalent of libzmq, while org.zeromq is inspired from czmq. Both packages are java-native.