@Override public void handleError(Exception exception) { LOG.error("Received error from LeaderRetrievalService.", exception); try { // stop associated webMonitor webMonitor.stop(); } catch (Exception e) { LOG.error("Error while stopping the web server due to a LeaderRetrievalService error.", e); } } }