Search in sources :

Example 1 with AmazonInfoConfig

use of com.netflix.appinfo.AmazonInfoConfig in project eureka by Netflix.

the class CompositeInstanceConfigFactory method get.

@Override
public synchronized EurekaInstanceConfig get() {
    if (eurekaInstanceConfig == null) {
        // create the amazonInfoConfig before we can determine if we are in EC2, as we want to use the amazonInfoConfig for
        // that determination. This is just the config however so is cheap to do and does not have side effects.
        AmazonInfoConfig amazonInfoConfig = new Archaius2AmazonInfoConfig(configInstance, namespace);
        if (isInEc2(amazonInfoConfig)) {
            eurekaInstanceConfig = new Ec2EurekaArchaius2InstanceConfig(configInstance, amazonInfoConfig, namespace);
            logger.info("Creating EC2 specific instance config");
        } else {
            eurekaInstanceConfig = new EurekaArchaius2InstanceConfig(configInstance, namespace);
            logger.info("Creating generic instance config");
        }
        // TODO: Remove this when DiscoveryManager is finally no longer used
        DiscoveryManager.getInstance().setEurekaInstanceConfig(eurekaInstanceConfig);
    }
    return eurekaInstanceConfig;
}
Also used : AmazonInfoConfig(com.netflix.appinfo.AmazonInfoConfig) Archaius2AmazonInfoConfig(com.netflix.appinfo.Archaius2AmazonInfoConfig) Ec2EurekaArchaius2InstanceConfig(com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig) EurekaArchaius2InstanceConfig(com.netflix.appinfo.EurekaArchaius2InstanceConfig) Ec2EurekaArchaius2InstanceConfig(com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig) Archaius2AmazonInfoConfig(com.netflix.appinfo.Archaius2AmazonInfoConfig)

Aggregations

AmazonInfoConfig (com.netflix.appinfo.AmazonInfoConfig)1 Archaius2AmazonInfoConfig (com.netflix.appinfo.Archaius2AmazonInfoConfig)1 Ec2EurekaArchaius2InstanceConfig (com.netflix.appinfo.Ec2EurekaArchaius2InstanceConfig)1 EurekaArchaius2InstanceConfig (com.netflix.appinfo.EurekaArchaius2InstanceConfig)1