From 57e057c825156b6effd15c07ee302f4ccdd2561c Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 25 Feb 2010 16:29:17 +0100 Subject: 1st version of Java poll added --- bindings/java/org/zmq/Context.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'bindings/java/org/zmq/Context.java') diff --git a/bindings/java/org/zmq/Context.java b/bindings/java/org/zmq/Context.java index 1b5ecb4..7a3552b 100644 --- a/bindings/java/org/zmq/Context.java +++ b/bindings/java/org/zmq/Context.java @@ -26,6 +26,10 @@ public class Context { public static final int POLL = 1; + public static final int POLLIN = 1; + public static final int POLLOUT = 2; + public static final int POLLERR = 4; + /** * Class constructor. * @@ -36,6 +40,20 @@ public class Context { construct (appThreads, ioThreads, flags); } + /** + * Issue a poll call on the specified 0MQ sockets. + * This function is experimental and may change in the future. + * + * @param socket an array of 0MQ Socket objects to poll. + * @param event an array of short values specifying what to poll for. + * @param revent an array of short values with the results. + * @param timeout the maximum timeout in microseconds. + */ + public native long poll (Socket[] socket, + short[] event, + short[] revent, + long timeout); + /** Initialize the JNI interface */ protected native void construct (int appThreads, int ioThreads, int flags); @@ -50,10 +68,9 @@ public class Context { * @return the internal 0MQ context handle. */ private long getContextHandle () { - return contextHandle; + return contextHandle; } - /** Opaque data used by JNI driver. */ private long contextHandle; } -- cgit v1.2.3