[zeromq-dev] HEADS UP: changes to Java binding public API

gonzalo diethelm gdiethelm at dcv.cl
Fri Apr 9 16:30:39 CEST 2010


> > Constructors:
> >
> >   ZMQ.Context c = new ZMQ.context(1, 1, ZMQ.POLL);
> >   ZMQ.Socket s = new ZMQ.Socket(c, ZMQ.PUB);
> >   ZMQ.Poller p = new ZMQ.Poller(c, 3);
> >
> > Functions:
> >
> >   ZMQ.Context c = ZMQ.context(1, 1, ZMQ.POLL);
> >   ZMQ.Socket s = c.socket(ZMQ.PUB);
> >   ZMQ.Poller p = c.poller(3);
> >
> > For Context itself the difference is really minimal, but for Socket
and
> > Poller I think the "functional" way is much clearer.
> >
> > Question: should I get rid of any of these two ways? My personal
vote is
> > to make all constructors private (getting rid of the "constructors"
way)
> > and stick to a strictly "functional" public API.
> 
> There have been a discussion about this a while ago and the general
> concensus was the same as yours.

Ok, I'm about ready to commit a patch in this direction. But before I do
that, another question. I have just realized that Poller objects (and
the whole zmq_poll() functionality) do not depend on Context at all. In
other words, I could perfectly change the code to make this possible:

  ZMQ.Context c = ZMQ.context(1, 1, ZMQ.POLL); // new Context, same as
above
  ZMQ.Socket s = c.socket(ZMQ.PUB);            // new Socket, same as
above
  ZMQ.Poller p = ZMQ.poller(3);                // new Poller, NO CONTEXT

On the other hand, it may be useful to be able to get the current 0MQ
Context from a Socket and/or a Poller object (which would force us build
Pollers from a starting Context):

  ZMQ.Context c1 = socket.getContext();
  ZMQ.Context c2 = poller.getContext();

What do you think?

-- 
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