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 +++++++++++++++++++-- bindings/java/org/zmq/Socket.java | 5 +---- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'bindings/java/org/zmq') 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; } diff --git a/bindings/java/org/zmq/Socket.java b/bindings/java/org/zmq/Socket.java index 84e2c52..851b7b8 100644 --- a/bindings/java/org/zmq/Socket.java +++ b/bindings/java/org/zmq/Socket.java @@ -50,7 +50,6 @@ public class Socket { public static final int SNDBUF = 11; public static final int RCVBUF = 12; - /** * Class constructor. * @@ -127,11 +126,9 @@ public class Socket { * @return the internal 0MQ socket handle. */ private long getSocketHandle () { - return socketHandle; + return socketHandle; } - /** Opaque data used by JNI driver. */ private long socketHandle; - } -- cgit v1.2.3