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

Martin Sustrik sustrik at 250bpm.com
Thu Feb 25 15:04:21 CET 2010


Hi Gonzalo,

> Find attached the patch, MIT-licensed, for adding poll support under
> Java. This patch does NOT include my logging functions; I hand-edited
> it, so if you have any problems applying the patch, let me know.

The patch is corrupt. Can you please generate a new one rather than 
editing it by hand? (You don't have to remove logging, I can do that.)

>> 1. You've added documentation to individual functions. These can be
>> processed by javadoc, right? In case you choose to offload the binding
>> from 0MQ project, generating the docs and placing them somewhere (we
> can
>> upload it for you if needed) would make sense.
> 
> If you mean the documentation in the Java classes, then yes; as far as I
> know, javadoc can process those without any problems.

Ok. We should try that later on.

>> 2. I still feel that Java API needs some beautification - especially
>> when it comes to namespacing. Compare Java and Ruby examples:
>>
>>    org.zmq.Socket s = new org.zmq.Socket (ctx, org.zmq.Socket.REP);
>>
>>    s = ZMQ::Socket.new(ctx, ZMQ::REP);
>>
>> Thoughts?

> 2. We could also have one big public class called ZMQ, with nested
> public classes:
> 
>   Implementation:
> 
>   package org.zmq;
> 
>   public class ZMQ {
>     public class Context {...}
>     public class Socket {...}
>     ...
>   }
> 
> 
>   Usage:
> 
>   import org.zmq.ZMQ;
>   ...
>   ZMQ.Socket s = new ZMQ.Socket (ctx, ZMQ.REP);

This looks much better!

> This is an API change, though. If you want to go this route, I can
> prepare a patch after the poll support has been committed.

I would go for it. The current API is plain ugly and it has to be 
changed sooner or later. (Btw, the same change was done to Ruby few 
weeks back. Same with Python.)

Martin




More information about the zeromq-dev mailing list