@Override
    public List<T> getClusterEndpoints() {
        long expiryTime = lastUpdateTime + currentReloadIntervalMs;
        if (expiryTime <= System.currentTimeMillis()) {
            try {
                ClusterResolver<T> newDelegate = reload();

                this.lastUpdateTime = System.currentTimeMillis();
                this.currentReloadIntervalMs = reloadIntervalMs;

                if (newDelegate != null) {
                    delegateRef.set(newDelegate);
                    lastReloadTimestamp = System.currentTimeMillis();
                    if (logger.isInfoEnabled()) {
                        logger.info("Reload endpoints differ from the original list; next reload in {}[sec], Loaded endpoints={}",
                                currentReloadIntervalMs / 1000, newDelegate.getClusterEndpoints());
                    }
                }
            } catch (Exception e) {
                this.currentReloadIntervalMs = Math.min(maxReloadIntervalMs, currentReloadIntervalMs * 2);
                logger.warn("Cluster resolve error; keeping the current Eureka endpoints; next reload in "
                        + "{}[sec]", currentReloadIntervalMs / 1000, e);
            }
        }
        return delegateRef.get().getClusterEndpoints();
    }
@Test(timeout = 30000)
    public void testDataAreReloadedPeriodically() throws Exception {
        List<AwsEndpoint> firstEndpointList = SampleCluster.UsEast1a.build();
        factory.setEndpoints(firstEndpointList);

        // First endpoint list is loaded eagerly
        resolver = new ReloadingClusterResolver<>(factory, 1);
        assertThat(resolver.getClusterEndpoints(), is(equalTo(firstEndpointList)));

        // Swap with a different one
        List<AwsEndpoint> secondEndpointList = SampleCluster.UsEast1b.build();
        factory.setEndpoints(secondEndpointList);

        assertThat(awaitUpdate(resolver, secondEndpointList), is(true));
    }