/** * Gets the full registry information from the eureka server and stores it * locally. * * @return the full registry information. */ public boolean storeFullRegistry() { long currentGeneration = fetchRegistryGeneration.get(); Applications apps = fetchRemoteRegistry(false); if (apps == null) { logger.error("The application is null for some reason. Not storing this information"); } else if (fetchRegistryGeneration.compareAndSet(currentGeneration, currentGeneration + 1)) { applications.set(apps); applicationsDelta.set(apps); logger.info("Successfully updated registry with the latest content"); return true; } else { logger.warn("Not updating applications as another thread is updating it already"); } return false; }
/** * Reconciles the delta information fetched to see if the hashcodes match. * * @param delta - the delta information fetched previously for reconciliation. * @param reconcileHashCode - the hashcode for comparison. * @return - response * @throws Throwable */ private boolean reconcileAndLogDifference(Applications delta, String reconcileHashCode) throws Throwable { logger.warn("The Reconcile hashcodes do not match, client : {}, server : {}. Getting the full registry", reconcileHashCode, delta.getAppsHashCode()); long currentGeneration = fetchRegistryGeneration.get(); Applications apps = this.fetchRemoteRegistry(false); if (apps == null) { logger.error("The application is null for some reason. Not storing this information"); return false; } if (fetchRegistryGeneration.compareAndSet(currentGeneration, currentGeneration + 1)) { applications.set(apps); applicationsDelta.set(apps); logger.warn("The Reconcile hashcodes after complete sync up, client : {}, server : {}.", getApplications().getReconcileHashCode(), delta.getAppsHashCode()); return true; }else { logger.warn("Not setting the applications map as another thread has advanced the update generation"); return true; // still return true } }
private boolean fetchAndStoreDelta() throws Throwable { long currGeneration = fetchRegistryGeneration.get(); Applications delta = fetchRemoteRegistry(true);
/** * Gets the full registry information from the eureka server and stores it * locally. * * @return the full registry information. */ public boolean storeFullRegistry() { long currentGeneration = fetchRegistryGeneration.get(); Applications apps = fetchRemoteRegistry(false); if (apps == null) { logger.error("The application is null for some reason. Not storing this information"); } else if (fetchRegistryGeneration.compareAndSet(currentGeneration, currentGeneration + 1)) { applications.set(apps); applicationsDelta.set(apps); logger.info("Successfully updated registry with the latest content"); return true; } else { logger.warn("Not updating applications as another thread is updating it already"); } return false; }
/** * Reconciles the delta information fetched to see if the hashcodes match. * * @param delta - the delta information fetched previously for reconciliation. * @param reconcileHashCode - the hashcode for comparison. * @return - response * @throws Throwable */ private boolean reconcileAndLogDifference(Applications delta, String reconcileHashCode) throws Throwable { logger.warn("The Reconcile hashcodes do not match, client : {}, server : {}. Getting the full registry", reconcileHashCode, delta.getAppsHashCode()); long currentGeneration = fetchRegistryGeneration.get(); Applications apps = this.fetchRemoteRegistry(false); if (apps == null) { logger.error("The application is null for some reason. Not storing this information"); return false; } if (fetchRegistryGeneration.compareAndSet(currentGeneration, currentGeneration + 1)) { applications.set(apps); applicationsDelta.set(apps); logger.warn("The Reconcile hashcodes after complete sync up, client : {}, server : {}.", getApplications().getReconcileHashCode(), delta.getAppsHashCode()); return true; }else { logger.warn("Not setting the applications map as another thread has advanced the update generation"); return true; // still return true } }
private boolean fetchAndStoreDelta() throws Throwable { long currGeneration = fetchRegistryGeneration.get(); Applications delta = fetchRemoteRegistry(true);