Maintainers, I've created a patch for the jzmq Java client library for ZeroMQ for the addition of the ZMQ_RECOVERY_IVL_MSEC option in the set and get socket options. I've added in the convenience methods, just like for the "seconds" argument, and copied the docs from the C docs into the JavaDocs. I think it's clean, and we're using it currently.
>From 9693d71740d514bd62ff2b503419d4e8a6a6be27 Mon Sep 17 00:00:00 2001 From: Bob Beaty <[email protected]> Date: Tue, 7 Dec 2010 09:32:14 -0600 Subject: [PATCH] Added Recovery Interval Milliseconds Options With the addition of the Recovery Interval milliseconds option in the C library, it was necessary to add it to the Java code so that we could take advantage of it. The set-up is very similar to the C library - if there's no set value for the milliseconds option, then the seconds option will be used. Otherwise, the milliseconds setting will override the seconds. Signed-off-by: Bob Beaty <[email protected]> --- src/Socket.cpp | 2 ++ src/org/zeromq/ZMQ.java | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/Socket.cpp b/src/Socket.cpp index a154ec5..edeb88f 100755 --- a/src/Socket.cpp +++ b/src/Socket.cpp @@ -111,6 +111,7 @@ JNIEXPORT jlong JNICALL Java_org_zeromq_ZMQ_00024Socket_getLongSockopt (JNIEnv * case ZMQ_AFFINITY: case ZMQ_RATE: case ZMQ_RECOVERY_IVL: + case ZMQ_RECOVERY_IVL_MSEC: case ZMQ_MCAST_LOOP: case ZMQ_SNDBUF: case ZMQ_RCVBUF: @@ -193,6 +194,7 @@ JNIEXPORT void JNICALL Java_org_zeromq_ZMQ_00024Socket_setLongSockopt (JNIEnv *e case ZMQ_AFFINITY: case ZMQ_RATE: case ZMQ_RECOVERY_IVL: + case ZMQ_RECOVERY_IVL_MSEC: case ZMQ_MCAST_LOOP: case ZMQ_SNDBUF: case ZMQ_RCVBUF: diff --git a/src/org/zeromq/ZMQ.java b/src/org/zeromq/ZMQ.java index 5f53ccb..1df4667 100755 --- a/src/org/zeromq/ZMQ.java +++ b/src/org/zeromq/ZMQ.java @@ -290,6 +290,15 @@ public class ZMQ { } /** + * @see #setRecoveryIntervalMSec(long) + * + * @return the RecoveryIntervall in milliseconds. + */ + public long getRecoveryIntervalMSec () { + return getLongSockopt (RECOVERY_IVL_MSEC); + } + + /** * @see #setMulticastLoop(boolean) * * @return the Multicast Loop. @@ -510,6 +519,28 @@ public class ZMQ { } /** + * The 'ZMQ_RECOVERY_IVL_MSEC' option shall set the recovery interval, specified + * in milliseconds (ms) for multicast transports using the specified 'socket'. + * The recovery interval determines the maximum time in milliseconds that a + * receiver can be absent from a multicast group before unrecoverable data + * loss will occur. + * + * A non-zero value of the 'ZMQ_RECOVERY_IVL_MSEC' option will take precedence + * over the 'ZMQ_RECOVERY_IVL' option, but since the default for the + * 'ZMQ_RECOVERY_IVL_MSEC' is zero, the default is to use the 'ZMQ_RECOVERY_IVL' + * option value. + * + * CAUTION: Excersize care when setting large recovery intervals as the data needed for + * recovery will be held in memory. For example, a 1 minute recovery interval at a data rate + * of 1Gbps requires a 7GB in-memory buffer. {Purpose of this Method} + * + * @param recovery_ivl_msec + */ + public void setRecoveryIntervalMSec (long recovery_ivl_msec) { + setLongSockopt (RECOVERY_IVL_MSEC, recovery_ivl_msec); + } + + /** * The 'ZMQ_MCAST_LOOP' option shall control whether data sent via multicast transports * using the specified 'socket' can also be received by the sending host via loopback. A * value of zero disables the loopback functionality, while the default value of 1 enables @@ -674,6 +705,7 @@ public class ZMQ { private static final int EVENTS = 15; private static final int TYPE = 16; private static final int LINGER = 17; + private static final int RECOVERY_IVL_MSEC = 20; } /** -- 1.7.1 Thanks, Bob ([email protected]) The Man from S.P.U.D. We will write no code before it's designed. _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
