Source:
<code>private void cacheDomainEndpoints() { if (!initialized) { throw new IllegalStateException("CloudSearchEngine not initialized"); } if (!domainEndpointsCached) { final Set<String> managedDomains = new HashSet<>(); for (final DocumentConfiguration documentConfiguration : documentConfigurations.values()) { final String domainName = documentConfigurationHolder.schemaName() + "-" + documentConfiguration.namespace(); managedDomains.add(domainName); } final DescribeDomainsRequest describeDomainsRequest = new DescribeDomainsRequest(); describeDomainsRequest.setDomainNames(managedDomains); final DescribeDomainsResult describeDomainsResult = cloudSearchClient .describeDomains(describeDomainsRequest); final List<DomainStatus> domainStatusList = describeDomainsResult.getDomainStatusList(); <START> if (domainStatusList.size() == managedDomains.size()) { <END> for (final DomainStatus domainStatus : domainStatusList) { if (domainStatus.isCreated() && !domainStatus.isDeleted()) { final String documentServiceEndpoint = domainStatus.getDocService().getEndpoint(); final String searchServiceEndpoint = domainStatus.getSearchService().getEndpoint(); if (documentServiceEndpoint == null || searchServiceEndpoint == null) { domainEndpointsCached = false; return; } final AmazonCloudSearchDomain documentServiceClient = AmazonCloudSearchDomainClientBuilder .build(awsCredentials, documentServiceEndpoint); final AmazonCloudSearchDomain searchServiceClient = AmazonCloudSearchDomainClientBuilder.build( awsCredentials, searchServiceEndpoint); documentServiceClients.put(domainStatus.getDomainName(), documentServiceClient); searchServiceClients.put(domainStatus.getDomainName(), searchServiceClient); } } domainEndpointsCached = true; } } }</code><technical_language>appears if get of requested domain descriptions, a log message. a retry, throw exception</technical_language>

Target:
private void cacheDomainEndpoints() { if (!initialized) { throw new IllegalStateException("CloudSearchEngine not initialized"); } if (!domainEndpointsCached) { final Set<String> managedDomains = new HashSet<>(); for (final DocumentConfiguration documentConfiguration : documentConfigurations.values()) { final String domainName = documentConfigurationHolder.schemaName() + "-" + documentConfiguration.namespace(); managedDomains.add(domainName); } final DescribeDomainsRequest describeDomainsRequest = new DescribeDomainsRequest(); describeDomainsRequest.setDomainNames(managedDomains); final DescribeDomainsResult describeDomainsResult = cloudSearchClient .describeDomains(describeDomainsRequest); final List<DomainStatus> domainStatusList = describeDomainsResult.getDomainStatusList(); if (domainStatusList.size() != managedDomains.size()) { logger.info("Unable to cache CloudSearch document/search endpoints for: " + managedDomains); } else { for (final DomainStatus domainStatus : domainStatusList) { if (domainStatus.isCreated() && !domainStatus.isDeleted()) { final String documentServiceEndpoint = domainStatus.getDocService().getEndpoint(); final String searchServiceEndpoint = domainStatus.getSearchService().getEndpoint(); if (documentServiceEndpoint == null || searchServiceEndpoint == null) { domainEndpointsCached = false; return; } final AmazonCloudSearchDomain documentServiceClient = AmazonCloudSearchDomainClientBuilder .build(awsCredentials, documentServiceEndpoint); final AmazonCloudSearchDomain searchServiceClient = AmazonCloudSearchDomainClientBuilder.build( awsCredentials, searchServiceEndpoint); documentServiceClients.put(domainStatus.getDomainName(), documentServiceClient); searchServiceClients.put(domainStatus.getDomainName(), searchServiceClient); } } domainEndpointsCached = true; } } }