@Override public void panic(String message, Throwable t) { synchronized (this) { panic = true; LOGGER.error("PANIC: " + message, t); try { consul.agentClient().fail(serviceId, formatMessageWithStackTrace(message, t)); } catch (Exception e) { LOGGER.error("Failed to report panic to Consul agent.", e); } try { // We just failed the health check with a specific error message; // don't need to fail again with the generic one. Runtime.getRuntime().removeShutdownHook(shutdownHook); } catch (IllegalStateException e) { // Already shutting down? Not a problem. } } // todo think a little harder and exit in a more graceful way System.exit(1); }
consul.agentClient().fail(this.serviceId, "(" + this.serviceId + ") Connector process terminated."); } catch (Exception e) { System.err.println("Failed to report termination to Consul agent.");
election.awaitTermination(); Consul.newClient().agentClient().fail(serviceId, "(" + serviceId + ") Connector process terminated.");