public void blockUntilReady() {
        future = schedulerService
            .scheduleAtFixedRate(this::pollElasticSearch, initialDelaySecs, periodSecs, timeUnit);
        try {
            future.get(maxWaitSecs, timeUnit);
            if (!successful) {
                throw new FailedPollingException(latestException);
            }
            cancelQuietly();
        } catch (CancellationException | InterruptedException | ExecutionException e) {
            if (!successful) {
                throw new FailedPollingException(e);
            }
        } catch (TimeoutException toe) {
            LOGGER.error(toe, "Reached polling timeout limit of {0} secs without "
                + "successfully connecting to server {1}", maxWaitSecs, client);
            throw new FailedPollingException(toe);
        }
    }
Block calling thread until Elasticsearch can be reached successfully, the timeout period is exceeded,
or a fatal error occurs.

@throws FailedPollingException if Elasticsearch can not be reached, which wraps a range of checked
     and unchecked exceptions. {@link FailedPollingException#getCause()} contains the wrapped
     exception.
common/es/src/main/java/io/apiman/common/es/util/EsConnectionPoller.java