[zeromq-dev] Regarding java binding of 0MQ.

SM swapnil at hardcodr.com
Tue Nov 23 22:06:05 CET 2010


+1 Alexey,

When I suggested two variant of Poller.poll() method, my only purpose
was to mimic the core libraries, which means less learning curve for
new users. Also I think it makes sense if we combine the functionality
of two methods in one, because current Poller.poll() is almost useless
if we do not set timeout before calling it (may be I am missing any
useful use-case where poll() can be called independently). But doing
that will seriously break the existing semantics of
poll()/[gs]setTimeout methods.
Considering this I suggest:
1. Poller.poll() method with default behavior to wait indefinitely.
2. Poller.poll(timeout), with clear documentation that for timeout =
-1 it will wait indefinitely otherwise it will wait for specified time
before method call will return if no events are available.
3. deprecate Poller.[sg]etTimeout and to prevent existing code to
break, fallback to previous behavior if user explicitly calls such
methods before calling poll(), that is poll() will wait for given
time-period. That leaves only one problematic case; if there is
existing code which uses poll (without setting timeout) to check any
immediate events available. I am clueless about this scenario.

--
SM

On Wed, Nov 24, 2010 at 2:25 AM, Alexey Ermakov <zee at technocore.ru> wrote:
> On Tue, Nov 23, 2010 at 6:00 PM, gonzalo diethelm <gdiethelm at dcv.cl> wrote:
>> #3: If we go this route, #2 would be moot. But the two behaviors are not
>> exactly the same. For Object, you specify a timeout of 0 if you want to wait
>> indefinitely, and -1 is illegal. For Poller, -1 means wait indefinitely and
>> 0 means “wait at most a very short time”. We would also have to define how
>> to deprecate Poller.[gs]etTimeout(). Ideas?
>
> Why not have two branches of jzmq like with zmq itself?
> E.g. maint (tracking 0mq/maint, maven/ivy/etc version 2.0.10) and
> master (tracking 0mq/master, maven/ivy/etc v2.1.0). That way you could
> mark getTimeout/setTimeout as @Deprecated in maint and remove them in
> master.
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list