();
- }
frames.push(e);
}
@@ -702,12 +634,7 @@ public boolean remove(Object o)
@Override
public ZFrame removeFirst()
{
- try {
- return frames.removeFirst();
- }
- catch (NoSuchElementException e) {
- return null;
- }
+ return frames.pollFirst();
}
@Override
@@ -719,12 +646,7 @@ public boolean removeFirstOccurrence(Object o)
@Override
public ZFrame removeLast()
{
- try {
- return frames.removeLast();
- }
- catch (NoSuchElementException e) {
- return null;
- }
+ return frames.pollLast();
}
@Override
@@ -739,6 +661,16 @@ public int size()
return frames.size();
}
+ public void append(ZMsg msg)
+ {
+ if (msg == null) {
+ return;
+ }
+ for (ZFrame frame : msg.frames) {
+ add(frame);
+ }
+ }
+
/**
* Returns pretty string representation of multipart message:
* [ frame0, frame1, ..., frameN ]
diff --git a/src/main/java/org/zeromq/ZPoller.java b/src/main/java/org/zeromq/ZPoller.java
index bbf00e685..439da3eb2 100644
--- a/src/main/java/org/zeromq/ZPoller.java
+++ b/src/main/java/org/zeromq/ZPoller.java
@@ -62,7 +62,7 @@
* The motivations of this rewriting are:
*
- * - the bare poller use {@link zmq.ZMQ#poll(zmq.PollItem[], int, long) this method} who does not allow
+ * - the bare poller use {@link zmq.ZMQ#poll(zmq.poll.PollItem[], int, long) this method} who does not allow
* to choose the selector used for polling, relying on a ThreadLocal, which is dangerous.
*
* - the bare poller use algorithms tailored for languages with manual allocation.
@@ -98,7 +98,7 @@ public static interface EventsHandler
public static interface ItemHolder
{
// the inner ZMQ poll item
- zmq.PollItem item();
+ zmq.poll.PollItem item();
// the related ZeroMQ socket
Socket socket();
@@ -149,7 +149,7 @@ public ZPollItem(final SelectableChannel channel, final EventsHandler handler, f
}
@Override
- public zmq.PollItem item()
+ public zmq.poll.PollItem item()
{
return base();
}
@@ -233,12 +233,12 @@ public EventsHandler handler()
/*
* These values can be ORed to specify what we want to poll for.
*/
- public static final int POLLIN = Poller.POLLIN;
+ public static final int POLLIN = Poller.POLLIN;
public static final int POLLOUT = Poller.POLLOUT;
public static final int POLLERR = Poller.POLLERR;
// same values with shorter writing
- public static final int IN = POLLIN;
+ public static final int IN = POLLIN;
public static final int OUT = POLLOUT;
public static final int ERR = POLLERR;
@@ -317,7 +317,7 @@ public ZPoller(final ItemCreator creator, final Selector selector)
{
this.creator = creator;
this.selector = selector;
- items = new HashMap