public URI discoverEndpoint(String key, AmazonWebServiceRequest request, boolean required, URI defaultEndpoint) {
        if (required) {
            try {
                return put(key, request, cacheLoader.load(key, request), defaultEndpoint);
            } catch (Exception e) {
                throw new SdkClientException("Unable to discover required endpoint for request.", e);
            }
        }  else {
            loadAndScheduleRefresh(key, request, 1, defaultEndpoint);
            return defaultEndpoint;
        }
    }
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