Пример #1
0
 private void handleException(Exception e) {
   if (INTERRUPTED_EXCEPTION_TYPES.contains(e.getClass())) {
     LOG.info("Changes feed was interrupted");
   } else {
     LOG.error("Caught exception while listening to changes feed:", e);
   }
 }
Пример #2
0
 public void run() {
   try {
     String line = reader.readLine();
     while (shouldRun && line != null) {
       if (line.length() > 0) {
         handleChange(line);
       } else {
         handleHeartbeat();
       }
       line = reader.readLine();
     }
     String reason = !shouldRun ? "Cancelled" : "EOF";
     LOG.info("Changes feed stopped. Reason: " + reason);
   } catch (Exception e) {
     handleException(e);
   } finally {
     sendInterruptMarker();
     httpResponse.abort();
     try {
       reader.close();
     } catch (IOException e) {
     }
   }
 }
Пример #3
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);
 }
Пример #4
0
 public void cancel() {
   LOG.debug("Feed cancelled");
   shouldRun = false;
   thread.interrupt();
 }
Пример #5
0
 private void handleHeartbeat() {
   LOG.debug("Got heartbeat from DB");
 }