/** * Gets the next tap message from the queue of received tap messages. * * @param time the amount of time to wait for a message. * @param timeunit the unit of time to use. * @return The tap message at the head of the queue or null if the queue is * empty for the given amount of time. */ public ResponseMessage getNextMessage(long time, TimeUnit timeunit) { try { Object m = rqueue.poll(time, timeunit); if (m == null) { return null; } else if (m instanceof ResponseMessage) { return (ResponseMessage) m; } else if (m instanceof TapAck) { TapAck ack = (TapAck) m; tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(), ack.getCallback()); return null; } else { throw new RuntimeException("Unexpected tap message type"); } } catch (InterruptedException e) { shutdown(); return null; } }
/** * Gets the next tap message from the queue of received tap messages. * * @param time the amount of time to wait for a message. * @param timeunit the unit of time to use. * @return The tap message at the head of the queue or null if the queue is * empty for the given amount of time. */ public ResponseMessage getNextMessage(long time, TimeUnit timeunit) { try { Object m = rqueue.poll(time, timeunit); if (m == null) { return null; } else if (m instanceof ResponseMessage) { return (ResponseMessage) m; } else if (m instanceof TapAck) { TapAck ack = (TapAck) m; tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(), ack.getCallback()); return null; } else { throw new RuntimeException("Unexpected tap message type"); } } catch (InterruptedException e) { shutdown(); return null; } }
/** * Gets the next tap message from the queue of received tap messages. * * @param time the amount of time to wait for a message. * @param timeunit the unit of time to use. * @return The tap message at the head of the queue or null if the queue is * empty for the given amount of time. */ public ResponseMessage getNextMessage(long time, TimeUnit timeunit) { try { Object m = rqueue.poll(time, timeunit); if (m == null) { return null; } else if (m instanceof ResponseMessage) { return (ResponseMessage) m; } else if (m instanceof TapAck) { TapAck ack = (TapAck) m; tapAck((com.couchbase.client.TapConnectionProvider)ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(), ack.getCallback()); return null; } else { throw new RuntimeException("Unexpected tap message type"); } } catch (InterruptedException e) { shutdown(); return null; } }
/** * Gets the next tap message from the queue of received tap messages. * * @param time the amount of time to wait for a message. * @param timeunit the unit of time to use. * @return The tap message at the head of the queue or null if the queue is * empty for the given amount of time. */ public ResponseMessage getNextMessage(long time, TimeUnit timeunit) { try { Object m = rqueue.poll(time, timeunit); if (m == null) { return null; } else if (m instanceof ResponseMessage) { return (ResponseMessage) m; } else if (m instanceof TapAck) { TapAck ack = (TapAck) m; tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(), ack.getCallback()); return null; } else { throw new RuntimeException("Unexpected tap message type"); } } catch (InterruptedException e) { shutdown(); return null; } }