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