@Override public void stop() { logger.info("Avro source {} stopping: {}", getName(), this); server.close(); try { server.join(); } catch (InterruptedException e) { logger.info( "Avro source " + getName() + ": Interrupted while waiting " + "for Avro server to stop. Exiting. Exception follows.", e); } sourceCounter.stop(); connectionCountUpdater.shutdown(); while (!connectionCountUpdater.isTerminated()) { try { Thread.sleep(100); } catch (InterruptedException ex) { logger.error( "Interrupted while waiting for connection count executor " + "to terminate", ex); Throwables.propagate(ex); } } super.stop(); logger.info("Avro source {} stopped. Metrics: {}", getName(), sourceCounter); }