summaryrefslogtreecommitdiff
path: root/bindings/java/org/zmq
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-02-25 16:29:17 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-02-25 16:29:17 +0100
commit57e057c825156b6effd15c07ee302f4ccdd2561c (patch)
tree767cdd46ee64b7a6d601c94eb5888598fae7db8c /bindings/java/org/zmq
parented8fe68383ca94ca33a9919bc2ed5b5a5d62cab0 (diff)
1st version of Java poll added
Diffstat (limited to 'bindings/java/org/zmq')
-rw-r--r--bindings/java/org/zmq/Context.java21
-rw-r--r--bindings/java/org/zmq/Socket.java5
2 files changed, 20 insertions, 6 deletions
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;
-
}