Package com.netflix.discovery.providers

Source Code of com.netflix.discovery.providers.DefaultEurekaClientConfigProvider

package com.netflix.discovery.providers;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.netflix.discovery.DefaultEurekaClientConfig;
import com.netflix.discovery.EurekaClientConfig;
import com.netflix.discovery.EurekaNamespace;

/**
* This provider is necessary because the namespace is optional.
* @author elandau
*/
public class DefaultEurekaClientConfigProvider implements Provider<EurekaClientConfig> {

    @Inject(optional = true)
    @EurekaNamespace
    private String namespace;

    private DefaultEurekaClientConfig config;
   
    @Override
    public synchronized EurekaClientConfig get() {
        if (config == null) {
            if (namespace == null) {
                config = new DefaultEurekaClientConfig();
            } else {
                config = new DefaultEurekaClientConfig(namespace);
            }
        }
        return config;
    }
}
TOP

Related Classes of com.netflix.discovery.providers.DefaultEurekaClientConfigProvider

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.