/** * {@inheritDoc} */ @Override public void shutdown(boolean awaitShutdown) { // 1. Shutdown the ExecutorService if (!sessionExecutor.isShutdown()) { sessionExecutor.shutdown(); if (awaitShutdown) { try { if (!sessionExecutor.awaitTermination(configuration.getShutdownTimeout(), TimeUnit.SECONDS)) { log.error("DiagnosisEngine executor did not shutdown within: {} seconds.", configuration.getShutdownTimeout()); } } catch (InterruptedException e) { log.error("InterruptedException occured during termination of the DiagnosisEngine executor.", e); } } } // 2. Shutdown the session pool try { sessionPool.close(); } catch (Exception e) { log.error("Failed closing DiagnosisEngine session pool.", e); } }