@Override
    protected void doHealthCheck(final Health.Builder builder) {
        var poolBuilder = builder.up();
        var message = StringUtils.EMPTY;
        try {
            val result = this.executor.submit(new Validator(this, builder));
            poolBuilder = result.get(this.maxWait, TimeUnit.MILLISECONDS);
            message = "OK";
        } catch (final TimeoutException e) {
            poolBuilder.down();
            message = String.format("Pool validation timed out. Max wait is %s ms.", this.maxWait);
            LOGGER.trace(e.getMessage(), e);
        } catch (final Exception e) {
            poolBuilder.outOfService();
            message = e.getMessage();
            LOGGER.trace(e.getMessage(), e);
        }
        poolBuilder
            .withDetail("message", message)
            .withDetail("name", getClass().getSimpleName())
            .withDetail("activeCount", getActiveCount())
            .withDetail("idleCount", getIdleCount());
    }
Shuts down the thread pool. Subclasses whose wish to override this method
must call super.destroy().
core/cas-server-core-monitor/src/main/java/org/apereo/cas/monitor/AbstractPoolHealthIndicator.java