[zeromq-dev] Java binding

gonzalo diethelm gdiethelm at dcv.cl
Mon Feb 22 14:17:35 CET 2010


I have modified the Java binding to make it "cleaner" (which is
subjective, admittedly). I attacked mainly the following point:

> >    2. Why is function createSocket() defined in Context.cpp if it is
> >       only called (in a convoluted, dynamic manner) from Socket.cpp?
> >       Wouldn't it make more sense to move it to Socket.cpp?
> 
> It's done that way because zmq_socket needs context pointer which in
not
> available in the Socket object. But maybe it can be made neater? Maybe
> it can be called in dynamic manner? Maybe Socket can get the context
> pointer from the Context object in more sane way? Once again - feel
free
> to contribute.

What I did is add Context::getContextHandle() and
Socket::getSocketHandle(), which to me is more orthogonal and future
proof. I also cleaned up the code a little bit and added all kinds of
comments. I am attaching the files to this message.

> >    1. Function zmq_poll() does not seem to be currently supported
under
> >       Java. Is there a fundamental reason that makes it impossible
to
> >       support it? If not, is anybody working of adding support for
it on
> >       Java?
> 
> No fundamental problem. zmq_poll is quite new and it haven't been
> wrapped in all the bindings yet. Feel free to contribute!

I would like some opinions on how to tackle this. I have never used
non-blocking sockets in Java, so I am not familiar with the mechanisms
there. It seems they are used through Selectors, right? If that is the
case, can anybody comment on the following points?

1. How to map Selectors to socket descriptors.
2. What interface to offer through OMQ's Java binding for zmq_poll(),
that would make sense in the Java world.

Thanks,

-- 
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. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Context.cpp
Type: application/octet-stream
Size: 3187 bytes
Desc: Context.cpp
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100222/a8d74f9a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Socket.cpp
Type: application/octet-stream
Size: 8478 bytes
Desc: Socket.cpp
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100222/a8d74f9a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Context.java
Type: application/octet-stream
Size: 1767 bytes
Desc: Context.java
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100222/a8d74f9a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Socket.java
Type: application/octet-stream
Size: 3903 bytes
Desc: Socket.java
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100222/a8d74f9a/attachment-0003.obj>


More information about the zeromq-dev mailing list