public ScheduledFuture<URI> loadAndScheduleRefresh(final String key,
                                                       final AmazonWebServiceRequest request,
                                                       final long refreshPeriod,
                                                       final URI defaultEndpoint) {
        return executorService.schedule(new Callable<URI>() {
            @Override
            public URI call() {
                try {
                    return put(key, request, cacheLoader.load(key, request), defaultEndpoint);
                } catch (Exception e) {
                    log.debug("Failed to refresh cached endpoint. Scheduling another refresh in 5 minutes");
                    loadAndScheduleRefresh(key, request,5, defaultEndpoint);
                    return null;
                }
            }
        }, refreshPeriod, TimeUnit.MINUTES);
    }
Abstract method to be implemented by each service to handle storing endpoints
in it's cache. This method must schedule refresh of cache values whenever putting
a new endpoint into it's cache.

@param key - The cache key
@param discoveryRequest  An endpoint discovery request containing additional discovery parameters.
@param endpointDetails - The details for an endpoint including the address and cache period.
@return The endpoint used for this request
aws-java-sdk-core/src/main/java/com/amazonaws/endpointdiscovery/EndpointDiscoveryIdentifiersRefreshCache.java