Thanks, I've started just using ZMQ.* now as well. Got the javadocs built via 
maven as well.

Peter

From: [email protected] 
[mailto:[email protected]] On Behalf Of Joshua Foster
Sent: Thursday, November 15, 2012 3:23 PM
To: ZeroMQ development list
Subject: Re: [zeromq-dev] fun with Java API

The bindings have JavaDoc. You can generate it with the maven build. I don't 
use the Z* objects. I usually use the ZMQ.*

ZMQ.Context context = ZMQ.context(1);
etc...

Joshua


[cid:[email protected]]
Peter Friend<mailto:[email protected]>
Thursday, November 15, 2012 5:13 PM
Perhaps I have missed it, but as far as I can tell there is no up-to-date 
reference for the Java zeromq bindings. But that's a minor issue as I can 
RTFS...

This has been a source of annoyance:

   public ZContext() {
      context = null;      // Don't create Context until create 1st 0MQ socket
      sockets = new CopyOnWriteArrayList<Socket>();
      ioThreads = 1;
      linger = 0;
      main = true;
   }

I am not sure why the context is not created at this point, but it can cause 
problems if you have an object which has callback hooks for 
registering/unregistering the sockets on a Poller. I create my objects which 
create their sockets and manage their connections, but I need to create a 
Poller before that point whether I am passing in the Poller explicitly, or 
referring to a global copy from an overridden method. Creating a socket and 
then ditching it is a workaround, but is annoying and you have to have a loud 
comment there so someone doesn't accidentally delete your obviously lame code 
which is creating a socket then immediately closing it. I am proposing this 
solution:

  public Context getContext() {
      if (isMain() && context == null)
         context = ZMQ.context(ioThreads);
      return context;
  }

Of course if you want >1 thread you have to set that value before calling 
createSocket() or getContext().

Cheers,

Peter

_______________________________________________
zeromq-dev mailing list
[email protected]<mailto:[email protected]>
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

<<inline: image001.jpg>>

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to