protected void configure()

in src/main/java/org/apache/sling/discovery/oak/Config.java [164:257]


    protected void configure(final DiscoveryServiceCentralConfig config) {
        this.connectorPingTimeout = guardLong(c -> config.connectorPingTimeout(), "connectorPingTimeout", DEFAULT_TOPOLOGY_CONNECTOR_TIMEOUT);
        logger.debug("configure: connectorPingTimeout='{}'", this.connectorPingTimeout);

        this.connectorPingInterval = guardLong(c -> config.connectorPingInterval(), "connectorPingInterval", DEFAULT_TOPOLOGY_CONNECTOR_INTERVAL);
        logger.debug("configure: connectorPingInterval='{}'", this.connectorPingInterval);

        this.discoveryLiteCheckInterval = guardLong(c -> config.discoveryLiteCheckInterval(), "discoveryLiteCheckInterval", DEFAULT_DISCOVERY_LITE_CHECK_INTERVAL);
        logger.debug("configure: discoveryLiteCheckInterval='{}'", this.discoveryLiteCheckInterval);

        this.clusterSyncServiceTimeout = guardLong(c -> config.clusterSyncServiceTimeout(), "clusterSyncServiceTimeout", DEFAULT_CLUSTER_SYNC_SERVICE_TIMEOUT);
        logger.debug("configure: clusterSyncServiceTimeout='{}'", this.clusterSyncServiceTimeout);

        this.clusterSyncServiceInterval = guardLong(c -> config.clusterSyncServiceInterval(), "clusterSyncServiceInterval", DEFAULT_CLUSTER_SYNC_SERVICE_INTERVAL);
        logger.debug("configure: clusterSyncServiceInterval='{}'", this.clusterSyncServiceInterval);

        this.minEventDelay = guardInt(c -> config.minEventDelay(), "minEventDelay", DEFAULT_MIN_EVENT_DELAY);
        logger.debug("configure: minEventDelay='{}'", this.minEventDelay);

        this.socketConnectTimeout = guardInt(c -> config.socketConnectTimeout(), "socketConnectTimeout", DEFAULT_SOCKET_CONNECT_TIMEOUT);
        logger.debug("configure: socketConnectTimeout='{}'", this.socketConnectTimeout);

        this.soTimeout = guardInt(c -> config.soTimeout(), "soTimeout", DEFAULT_SO_TIMEOUT);
        logger.debug("configure: soTimeout='{}'", this.soTimeout);

        String[] topologyConnectorUrlsStr = config.topologyConnectorUrls();
        if (topologyConnectorUrlsStr != null && topologyConnectorUrlsStr.length > 0) {
            List<URL> urls = new LinkedList<>();
            for (int i = 0; i < topologyConnectorUrlsStr.length; i++) {
                String anUrlStr = topologyConnectorUrlsStr[i];
                try {
                    if (anUrlStr != null && anUrlStr.length() > 0) {
                        URL url = new URL(anUrlStr);
                        logger.debug("configure: a topologyConnectorbUrl='{}'",
                                url);
                        urls.add(url);
                    }
                } catch (MalformedURLException e) {
                    logger.error("configure: could not set a topologyConnectorUrl: " + e,
                            e);
                }
            }
            if (urls.size() > 0) {
                this.topologyConnectorUrls = urls.toArray(new URL[urls.size()]);
                logger.debug("configure: number of topologyConnectorUrls='{}''",
                        urls.size());
            } else {
                this.topologyConnectorUrls = null;
                logger.debug("configure: no (valid) topologyConnectorUrls configured");
            }
        } else {
            this.topologyConnectorUrls = null;
            logger.debug("configure: no (valid) topologyConnectorUrls configured");
        }
        this.topologyConnectorWhitelist = config.topologyConnectorWhitelist();
        logger.debug("configure: topologyConnectorWhitelist='{}'", this.topologyConnectorWhitelist);

        this.discoveryResourcePath = config.discoveryResourcePath();
        while (this.discoveryResourcePath.endsWith("/")) {
            this.discoveryResourcePath = this.discoveryResourcePath.substring(0, this.discoveryResourcePath.length() - 1);
        }
        this.discoveryResourcePath = this.discoveryResourcePath + "/";
        if (this.discoveryResourcePath == null || this.discoveryResourcePath.length() <= 1) {
            // if the path is empty, or /, then use the default
            this.discoveryResourcePath = DEFAULT_DISCOVERY_RESOURCE_PATH;
        }
        logger.debug("configure: discoveryResourcePath='{}'", this.discoveryResourcePath);

        autoStopLocalLoopEnabled = config.autoStopLocalLoopEnabled();
        gzipConnectorRequestsEnabled = config.gzipConnectorRequestsEnabled();
        hmacEnabled = config.hmacEnabled();
        encryptionEnabled = config.enableEncryption();
        syncTokenEnabled = config.enableSyncToken();
        sharedKey = config.sharedKey();
        keyInterval = config.hmacSharedKeyTTL();

        backoffStandbyFactor = guardInt(c -> config.backoffStandbyFactor(), "backoffStandbyFactor", DEFAULT_BACKOFF_STANDBY_FACTOR);
        backoffStableFactor = guardInt(c -> config.backoffStableFactor(), "backoffStableFactor", DEFAULT_BACKOFF_STABLE_FACTOR);

        this.invertLeaderElectionPrefixOrder = config.invertLeaderElectionPrefixOrder();
        logger.debug("configure: invertLeaderElectionPrefixOrder='{}'", this.invertLeaderElectionPrefixOrder);

        this.leaderElectionPrefix = config.leaderElectionPrefix();
        logger.debug("configure: leaderElectionPrefix='{}'",  this.leaderElectionPrefix);

        this.suppressPartiallyStartedInstance = config.suppressPartiallyStartedInstance();
        logger.debug("configure: suppressPartiallyStartedInstance='{}'", this.suppressPartiallyStartedInstance);

        this.suppressionTimeoutSeconds = guardLong(c -> config.suppressionTimeoutSeconds(), "suppressionTimeoutSeconds", DEFAULT_SUPPRESSION_TIMEOUT_SECONDS);
        logger.debug("configure: suppressionTimeoutSeconds='{}'", this.suppressionTimeoutSeconds);

        this.joinerDelaySeconds = guardLong(c -> config.joinerDelaySeconds(), "joinerDelaySeconds", DEFAULT_JOINER_DELAY_SECONDS);
        logger.debug("configure: joinerDelaySeconds='{}'", this.joinerDelaySeconds);
    }