示例#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");
 }