@Override public void stateChanged(CuratorFramework client, ConnectionState newState) { if (client.getConnectionStateErrorPolicy().isErrorState(newState)) { try { LOGGER.warn("Shutdown quartz after state: {}", newState); quartzProcess.close(); } catch (IOException e) { LOGGER.error("Error while shutting down quartz process.", e); } } super.stateChanged(client, newState); } });