Code review comment: Yeah - the `DatabaseAccount` / `LocationCache` refresh part is greatly simplified now.

Code under review:
public boolean shouldRefreshEndpoints(Utils.ValueHolder<Boolean> canRefreshInBackground) {
        canRefreshInBackground.v = true;
        DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo;
        String mostPreferredLocation = Utils.firstOrDefault(currentLocationInfo.preferredLocations);

        String mostPreferredEffectiveReadLocation = StringUtils.EMPTY;
        String mostPreferredEffectiveWriteLocation = StringUtils.EMPTY;

        if (StringUtils.isEmpty(mostPreferredLocation)) {
            URI firstAccountLevelReadEndpoint = Utils.firstOrDefault(currentLocationInfo.readEndpoints);

            if (currentLocationInfo.regionNameByReadEndpoint != null) {
                mostPreferredEffectiveReadLocation
                    = currentLocationInfo.regionNameByReadEndpoint.getOrDefault(firstAccountLevelReadEndpoint, StringUtils.EMPTY);
            }

            URI firstAccountLevelWriteEndpoint = Utils.firstOrDefault(currentLocationInfo.writeEndpoints);

            if (currentLocationInfo.regionNameByWriteEndpoint != null) {
                mostPreferredEffectiveWriteLocation
                    = currentLocationInfo.regionNameByWriteEndpoint.getOrDefault(firstAccountLevelWriteEndpoint, StringUtils.EMPTY);
            }
        }

        String mostPreferredReadLocationToUse = !Strings.isNullOrEmpty(mostPreferredLocation) ?
            mostPreferredLocation : mostPreferredEffectiveReadLocation;

        String mostPreferredWriteLocationToUse = !Strings.isNullOrEmpty(mostPreferredLocation) ?
            mostPreferredLocation : mostPreferredEffectiveWriteLocation;

        
        if (this.enableEndpointDiscovery) {

            boolean shouldRefresh = this.useMultipleWriteLocations && !this.enableMultipleWriteLocations;
            List<URI> readLocationEndpoints = currentLocationInfo.readEndpoints;


            if (this.isEndpointUnavailable(readLocationEndpoints.get(0), OperationType.Read)) {
                
                
                canRefreshInBackground.v = anyEndpointsAvailable(readLocationEndpoints, OperationType.Read);
                logger.debug("shouldRefreshEndpoints = true,  since the first read endpoint " +
                        "[{}] is not available for read. canRefreshInBackground = [{}]",
                    readLocationEndpoints.get(0),
                    canRefreshInBackground.v);
                return true;
            }

            if (!Strings.isNullOrEmpty(mostPreferredReadLocationToUse)) {
                Utils.ValueHolder<URI> mostPreferredReadEndpointHolder = new Utils.ValueHolder<>();
                Utils.ValueHolder<URI> firstAccountLevelReadEndpointHolder = new Utils.ValueHolder<>();

                logger.debug("getReadEndpoints [{}]", readLocationEndpoints);

                if (Utils.tryGetValue(currentLocationInfo.availableReadEndpointByLocation, mostPreferredReadLocationToUse, mostPreferredReadEndpointHolder)) {
                    logger.debug("most preferred is [{}], most preferred available is [{}]",
                        mostPreferredReadLocationToUse, mostPreferredReadEndpointHolder.v);
                    if (!areEqual(mostPreferredReadEndpointHolder.v, readLocationEndpoints.get(0))) {
                        
                        
                        logger.debug("shouldRefreshEndpoints = true, most preferred location [{}]" +
                                " is not available for read.", mostPreferredReadLocationToUse);
                        return true;
                    }

                    
                    
                    else if (currentLocationInfo.preferredLocations == null || currentLocationInfo.preferredLocations.isEmpty()) {

                        List<String> accountLevelReadRegions = currentLocationInfo.availableReadLocations;
                        String firstAccountLevelReadRegion = Utils.firstOrDefault(accountLevelReadRegions);

                        if (Utils.tryGetValue(currentLocationInfo.availableReadEndpointByLocation, firstAccountLevelReadRegion, firstAccountLevelReadEndpointHolder)) {

                            if (!areEqual(mostPreferredReadEndpointHolder.v, firstAccountLevelReadEndpointHolder.v)) {
                                logger.debug("shouldRefreshEndpoints = true, preferredRegions on client is empty and first account-level read region [{}]" +
                                    " is not available for read.", firstAccountLevelReadRegion);
                                return true;
                            }
                        }
                    }

                    logger.debug("most preferred is [{}], and most preferred available [{}] are the same",
                            mostPreferredLocation, mostPreferredReadEndpointHolder.v);
                }
                else {
                    logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] " +
                            "is not in available read locations.", mostPreferredLocation);
                    return true;
                }
            }

            Utils.ValueHolder<URI> mostPreferredWriteEndpointHolder = new Utils.ValueHolder<>();
            List<URI> writeLocationEndpoints = currentLocationInfo.writeEndpoints;
            logger.debug("getWriteEndpoints [{}]", writeLocationEndpoints);

            if (!this.canUseMultipleWriteLocations()) {
                if (this.isEndpointUnavailable(writeLocationEndpoints.get(0), OperationType.Write)) {
                    
                    
                    canRefreshInBackground.v = anyEndpointsAvailable(writeLocationEndpoints,OperationType.Write);
                    logger.debug("shouldRefreshEndpoints = true, most preferred location " +
                                    "[{}] endpoint [{}] is not available for write. canRefreshInBackground = [{}]",
                            mostPreferredLocation,
                            writeLocationEndpoints.get(0),
                            canRefreshInBackground.v);

                    return true;
                } else {
                    logger.debug("shouldRefreshEndpoints: false, [{}] is available for Write", writeLocationEndpoints.get(0));
                    return shouldRefresh;
                }
            } else if (!Strings.isNullOrEmpty(mostPreferredWriteLocationToUse)) {
                if (Utils.tryGetValue(currentLocationInfo.availableWriteEndpointByLocation, mostPreferredWriteLocationToUse, mostPreferredWriteEndpointHolder)) {
                    shouldRefresh = ! areEqual(mostPreferredWriteEndpointHolder.v, writeLocationEndpoints.get(0));

                    
                    
                    if (currentLocationInfo.preferredLocations == null || currentLocationInfo.preferredLocations.isEmpty()) {

                        List<String> accountLevelWriteRegions = currentLocationInfo.availableWriteLocations;
                        String firstAccountLevelWriteRegion = Utils.firstOrDefault(accountLevelWriteRegions);
                        Utils.ValueHolder<URI> firstAccountLevelWriteEndpointHolder = new Utils.ValueHolder<>();

                        if (Utils.tryGetValue(currentLocationInfo.availableWriteEndpointByLocation, firstAccountLevelWriteRegion, firstAccountLevelWriteEndpointHolder)) {

                            if (!areEqual(mostPreferredWriteEndpointHolder.v, firstAccountLevelWriteEndpointHolder.v)) {
                                logger.debug("shouldRefreshEndpoints = true, preferredRegions on client is empty and first account-level write region [{}]" +
                                    " is not available for write.", firstAccountLevelWriteRegion);
                                shouldRefresh = true;
                            }
                        }
                    }

                    if (shouldRefresh) {
                        logger.debug("shouldRefreshEndpoints: true, write endpoint [{}] is not the same as most preferred [{}]",
                                writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v);
                    } else {
                        logger.debug("shouldRefreshEndpoints: false, write endpoint [{}] is the same as most preferred [{}]",
                                writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v);
                    }

                    return shouldRefresh;
                } else {
                    logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] is not in available write locations",
                            mostPreferredLocation);
                    return true;
                }
            } else {
                logger.debug("shouldRefreshEndpoints: false, mostPreferredLocation [{}] is empty", mostPreferredLocation);
                return shouldRefresh;
            }
        } else {
            logger.debug("shouldRefreshEndpoints: false, endpoint discovery not enabled");
            return false;
        }
    }

Line commented on: String mostPreferredEffectiveReadLocation = StringUtils.EMPTY;

Revised code:
public boolean shouldRefreshEndpoints(Utils.ValueHolder<Boolean> canRefreshInBackground) {
        canRefreshInBackground.v = true;
        DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo;
        String mostPreferredLocation = Utils.firstOrDefault(currentLocationInfo.preferredLocations);

        if (StringUtils.isEmpty(mostPreferredLocation)) {
            mostPreferredLocation = Utils.firstOrDefault(currentLocationInfo.effectivePreferredLocations);
        }

        
        if (this.enableEndpointDiscovery) {

            boolean shouldRefresh = this.useMultipleWriteLocations && !this.enableMultipleWriteLocations;
            List<URI> readLocationEndpoints = currentLocationInfo.readEndpoints;
            if (this.isEndpointUnavailable(readLocationEndpoints.get(0), OperationType.Read)) {
                
                
                canRefreshInBackground.v = anyEndpointsAvailable(readLocationEndpoints,OperationType.Read);
                logger.debug("shouldRefreshEndpoints = true,  since the first read endpoint " +
                        "[{}] is not available for read. canRefreshInBackground = [{}]",
                    readLocationEndpoints.get(0),
                    canRefreshInBackground.v);
                return true;
            }

            if (!Strings.isNullOrEmpty(mostPreferredLocation)) {
                Utils.ValueHolder<URI> mostPreferredReadEndpointHolder = new Utils.ValueHolder<>();
                logger.debug("getReadEndpoints [{}]", readLocationEndpoints);

                if (Utils.tryGetValue(currentLocationInfo.availableReadEndpointByLocation, mostPreferredLocation, mostPreferredReadEndpointHolder)) {
                    logger.debug("most preferred is [{}], most preferred available is [{}]",
                            mostPreferredLocation, mostPreferredReadEndpointHolder.v);
                    if (!areEqual(mostPreferredReadEndpointHolder.v, readLocationEndpoints.get(0))) {
                        
                        
                        logger.debug("shouldRefreshEndpoints = true, most preferred location [{}]" +
                                " is not available for read.", mostPreferredLocation);
                        return true;
                    }

                    logger.debug("most preferred is [{}], and most preferred available [{}] are the same",
                            mostPreferredLocation, mostPreferredReadEndpointHolder.v);
                }
                else {
                    logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] " +
                            "is not in available read locations.", mostPreferredLocation);
                    return true;
                }
            }

            Utils.ValueHolder<URI> mostPreferredWriteEndpointHolder = new Utils.ValueHolder<>();
            List<URI> writeLocationEndpoints = currentLocationInfo.writeEndpoints;
            logger.debug("getWriteEndpoints [{}]", writeLocationEndpoints);

            if (!this.canUseMultipleWriteLocations()) {
                if (this.isEndpointUnavailable(writeLocationEndpoints.get(0), OperationType.Write)) {
                    
                    
                    canRefreshInBackground.v = anyEndpointsAvailable(writeLocationEndpoints,OperationType.Write);
                    logger.debug("shouldRefreshEndpoints = true, most preferred location " +
                                    "[{}] endpoint [{}] is not available for write. canRefreshInBackground = [{}]",
                            mostPreferredLocation,
                            writeLocationEndpoints.get(0),
                            canRefreshInBackground.v);

                    return true;
                } else {
                    logger.debug("shouldRefreshEndpoints: false, [{}] is available for Write", writeLocationEndpoints.get(0));
                    return shouldRefresh;
                }
            } else if (!Strings.isNullOrEmpty(mostPreferredLocation)) {
                if (Utils.tryGetValue(currentLocationInfo.availableWriteEndpointByLocation, mostPreferredLocation, mostPreferredWriteEndpointHolder)) {
                    shouldRefresh = ! areEqual(mostPreferredWriteEndpointHolder.v,writeLocationEndpoints.get(0));

                    if (shouldRefresh) {
                        logger.debug("shouldRefreshEndpoints: true, write endpoint [{}] is not the same as most preferred [{}]",
                                writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v);
                    } else {
                        logger.debug("shouldRefreshEndpoints: false, write endpoint [{}] is the same as most preferred [{}]",
                                writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v);
                    }

                    return shouldRefresh;
                } else {
                    logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] is not in available write locations",
                            mostPreferredLocation);
                    return true;
                }
            } else {
                logger.debug("shouldRefreshEndpoints: false, mostPreferredLocation [{}] is empty", mostPreferredLocation);
                return shouldRefresh;
            }
        } else {
            logger.debug("shouldRefreshEndpoints: false, endpoint discovery not enabled");
            return false;
        }
    }