public Config get()

in archaius2-persisted2/src/main/java/com/netflix/archaius/persisted2/Persisted2ConfigProvider.java [114:146]


    public Config get() {
        try {
            Persisted2ClientConfig clientConfig = config.get();
            LOG.info("Remote config : " + clientConfig);
            String url = new StringBuilder()
                .append(clientConfig.getServiceUrl())
                .append("?skipPropsWithExtraScopes=").append(clientConfig.getSkipPropsWithExtraScopes())
                .append("&filter=").append(URLEncoder.encode(getFilterString(clientConfig.getQueryScopes()), "UTF-8"))
                .toString();

            if (!clientConfig.isEnabled()) {
                return EmptyConfig.INSTANCE;
            }
            
            JsonPersistedV2Reader reader = JsonPersistedV2Reader.builder(new HTTPStreamLoader(new URL(url)))
                    .withPath("propertiesList")
                    .withScopes(clientConfig.getPrioritizedScopes())
                    .withPredicate(ScopePredicates.fromMap(clientConfig.getScopes()))
                    // If instrumentation flushing is enabled, we need to read the id fields as well to uniquely
                    // identify the property being used.
                    .withReadIdField(accessMonitorUtilOptional.isPresent())
                    .build();
            
            dynamicConfig =
                    new PollingDynamicConfig(
                            reader,
                            new FixedPollingStrategy(clientConfig.getRefreshRate(), TimeUnit.SECONDS),
                            accessMonitorUtilOptional.orElse(null));
            return dynamicConfig;
        } catch (Exception e1) {
            throw new RuntimeException(e1);
        }
    }