public int queueSize() { return changes.size(); }
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "RV_RETURN_VALUE_IGNORED_BAD_PRACTICE") private void sendInterruptMarker() { LOG.debug("Sending interrupt marker in order to interrupt feed consumer"); changes.offer(INTERRUPT_MARKER); }
private void checkIfInterrupted(DocumentChange c) throws InterruptedException { if (c == INTERRUPT_MARKER || (!shouldRun && changes.isEmpty())) { throw new InterruptedException(); } }
public DocumentChange next(long timeout, TimeUnit unit) throws InterruptedException { assertRunningState(); DocumentChange c = changes.poll(timeout, unit); checkIfInterrupted(c); return c; }
public DocumentChange poll() throws InterruptedException { assertRunningState(); DocumentChange c = changes.poll(); checkIfInterrupted(c); return c; }
private void handleChange(String line) throws IOException, InterruptedException, JsonParseException, JsonMappingException { changes.put(new StdDocumentChange(OBJECT_MAPPER.readTree(line))); }