[zeromq-dev] Initial support for zmq_poll() under Java

gonzalo diethelm gdiethelm at dcv.cl
Wed Feb 24 22:59:05 CET 2010

I have completed initial support for zmq_poll() in the Java binding. For
now it only supports ZMQ sockets. I will send a reply to this e-mail
explaining the interface and implementation issues.

It is in general very difficult to debug these kinds of bindings; Java
code calls C / C++ code, and the only sure way of knowing what's going
on in that code is through logging. Debuggers don't work well here
because of the mixed environment.

I have added a LOG() macro to the Java binding. It is called this way
from the C / C++ code (notice the double parenthesis):

  LOG(("Will poll socket 0x%p", socket));

If the preprocessor macro ZMQ_JAVA_DEBUG is undefined or it is 0, this
ends up being expanded to nothing and has zero cost at run time; if that
macro is greater than zero, it ends up calling

  zmq_java_log("Will poll socket 0x%p", socket);

This function appends that message to a file called "/tmp/zmq_java.log".

This functionality is implemented in a couple of files util.h and
util.cpp, under bindings/java/, and called from Context.cpp and

Question: would you accept a patch to create these two files and add
lots of LOG() calls to Context.cpp / Socket.cpp, which by default will
do nothing but which could be helpful in debugging this binding?

Gonzalo Diethelm 

Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena. 
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje. 

"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law. 
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message. 

More information about the zeromq-dev mailing list