[zeromq-dev] Requesting suggestions for getsockopt() in Java
gonzalo diethelm
gdiethelm at dcv.cl
Mon Aug 9 19:15:46 CEST 2010
> > So, if we go the full Java way, we would end up with the following
> > methods:
> >
> > void setSocketHWM(int hwm);
> > void setSocketSwap(int swap);
> > void setSocketAffinity(int affinity);
> > void setSocketIdentity(byte[] identity);
> > void setSocketSubscribe(byte[] subscribe);
> > void setSocketUnsubscribe(byte[] unsubscribe);
> > void setSocketRate(int rate);
> > void setSocketRecoveryInterval(int recovery_interval);
> > void setSocketMulticastLoop(boolean multicast_loop);
> > void setSocketSendBufferSize(int sndbuf);
> > void setSocketReceiveBufferSize(int rcvbuf);
> > void setSocketReceiveMore(boolean rcvmore);
> >
> > int getSocketHWM();
> > int getSocketSwap();
> > int getSocketAffinity();
> > byte[] getSocketIdentity();
> > byte[] getSocketSubscribe();
> > byte[] getSocketUnsubscribe();
> > int getSocketRate();
> > int getSocketRecoveryInterval();
> > boolean getSocketMulticastLoop();
> > int getSocketSendBufferSize();
> > int getSocketReceiveBufferSize();
> > boolean getSocketReceiveMore();
> >
> > Thoughts?
>
> What I saw on the page referenced by Steve looked like this:
>
> void setOption(int optID, Object val) throws SocketException;
> Object getOption(int optID) throws SocketException;
>
> Isn't that sandard Java sockopt interface?
I took that to mean they have those two low-level native methods
(probably declared as protected or private), and implement all the
high-level methods (such as the ones I listed for 0MQ) by calling those
two. This would make sense to me (#1).
It also makes sense (in an OO world) to NOT use the "Socket" word; these
are socket objects anyway, so we should have setHWM() and getRate()
(#2).
Finally, if we go this way I would like to deprecate (or simply
eliminate) the two setsockopt() methods and all the socket option
constants that are declared in ZMQ.java (#3).
This is my current "formal" proposal (#1, #2 and #3). More thoughts?
--
Gonzalo Diethelm
More information about the zeromq-dev
mailing list