Exemplo n.º 1
0
 public int queueSize() {
   return changes.size();
 }
Exemplo n.º 2
0
 @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);
 }
Exemplo n.º 3
0
 private void checkIfInterrupted(DocumentChange c) throws InterruptedException {
   if (c == INTERRUPT_MARKER || (!shouldRun && changes.isEmpty())) {
     throw new InterruptedException();
   }
 }
Exemplo n.º 4
0
 public DocumentChange next(long timeout, TimeUnit unit) throws InterruptedException {
   assertRunningState();
   DocumentChange c = changes.poll(timeout, unit);
   checkIfInterrupted(c);
   return c;
 }
Exemplo n.º 5
0
 public DocumentChange poll() throws InterruptedException {
   assertRunningState();
   DocumentChange c = changes.poll();
   checkIfInterrupted(c);
   return c;
 }
Exemplo n.º 6
0
 private void handleChange(String line)
     throws IOException, InterruptedException, JsonParseException, JsonMappingException {
   changes.put(new StdDocumentChange(OBJECT_MAPPER.readTree(line)));
 }