Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/netflix/master'
Browse files Browse the repository at this point in the history
Conflicts:
	eureka-client/src/main/java/com/netflix/discovery/converters/EurekaJacksonCodec.java
  • Loading branch information
Tomasz Bak committed May 14, 2015
2 parents 74738d0 + d34507d commit d6ade39
Show file tree
Hide file tree
Showing 55 changed files with 1,017 additions and 462 deletions.
Expand Up @@ -64,6 +64,10 @@ private ApplicationInfoManager() {
instance = this;
}

/**
* @deprecated please use DI instead
*/
@Deprecated
public static ApplicationInfoManager getInstance() {
return instance;
}
Expand Down
Expand Up @@ -22,7 +22,7 @@
/**
* Configuration information required by the instance to register with Eureka
* server. Once registered, users can look up information from
* {@link com.netflix.discovery.DiscoveryClient} based on virtual hostname (also called VIPAddress),
* {@link com.netflix.discovery.EurekaClient} based on virtual hostname (also called VIPAddress),
* the most common way of doing it or by other means to get the information
* necessary to talk to other instances registered with <em>Eureka</em>.
*
Expand Down
Expand Up @@ -18,7 +18,7 @@

/**
* Applications can implement this interface and register a callback with the
* {@link com.netflix.discovery.DiscoveryClient#registerHealthCheckCallback(HealthCheckCallback)}.
* {@link com.netflix.discovery.EurekaClient#registerHealthCheckCallback(HealthCheckCallback)}.
*
* <p>
* Your callback will be invoked every
Expand Down
30 changes: 28 additions & 2 deletions eureka-client/src/main/java/com/netflix/appinfo/InstanceInfo.java
Expand Up @@ -1011,7 +1011,7 @@ public synchronized void setOverriddenStatus(InstanceStatus status) {
}

/**
* Returns whether any state changed so that {@link DiscoveryClient} can
* Returns whether any state changed so that {@link com.netflix.discovery.EurekaClient} can
* check whether to retransmit info or not on the next heartbeat.
*
* @return true if the {@link InstanceInfo} is dirty, false otherwise.
Expand Down Expand Up @@ -1061,7 +1061,7 @@ public Boolean isCoordinatingDiscoveryServer() {

/**
* Returns the type of action done on the instance in the server.Primarily
* used for updating deltas in the {@link com.netflix.discovery.DiscoveryClient}
* used for updating deltas in the {@link com.netflix.discovery.EurekaClient}
* instance.
*
* @return action type done on the instance.
Expand Down Expand Up @@ -1153,4 +1153,30 @@ private static String resolveDeploymentContextBasedVipAddresses(
return result;
}

/**
* Get the zone that a particular instance is in.
* Note that for AWS deployments, myInfo should contain AWS dataCenterInfo which should contain
* the AWS zone of the instance, and availZones is ignored.
*
* @param availZones the list of available zones for non-AWS deployments
* @param myInfo
* - The InstanceInfo object of the instance.
* @return - The zone in which the particular instance belongs to.
*/
public static String getZone(String[] availZones, InstanceInfo myInfo) {
String instanceZone = ((availZones == null || availZones.length == 0) ? "default"
: availZones[0]);
if (myInfo != null
&& myInfo.getDataCenterInfo().getName() == DataCenterInfo.Name.Amazon) {

String awsInstanceZone = ((AmazonInfo) myInfo.getDataCenterInfo())
.get(AmazonInfo.MetaDataKey.availabilityZone);
if (awsInstanceZone != null) {
instanceZone = awsInstanceZone;
}

}
return instanceZone;
}

}
@@ -1,7 +1,5 @@
package com.netflix.appinfo.providers;

import javax.inject.Singleton;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.netflix.appinfo.CloudInstanceConfig;
Expand All @@ -12,7 +10,6 @@
* This provider is necessary because the namespace is optional.
* @author elandau
*/
@Singleton
public class CloudInstanceConfigProvider implements Provider<CloudInstanceConfig> {
@Inject(optional = true)
@EurekaNamespace
Expand Down
Expand Up @@ -3,7 +3,6 @@
import java.util.Map;

import javax.inject.Inject;
import javax.inject.Singleton;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -14,7 +13,6 @@
import com.netflix.appinfo.LeaseInfo;
import com.netflix.appinfo.InstanceInfo.InstanceStatus;
import com.netflix.appinfo.InstanceInfo.PortType;
import com.netflix.governator.guice.lazy.LazySingleton;

/**
* InstanceInfo provider that constructs the InstanceInfo this this instance using
Expand All @@ -23,7 +21,6 @@
* @author elandau
*
*/
@LazySingleton
public class EurekaConfigBasedInstanceInfoProvider implements Provider<InstanceInfo> {
private static final Logger LOG = LoggerFactory.getLogger(EurekaConfigBasedInstanceInfoProvider.class);

Expand Down
Expand Up @@ -2,11 +2,12 @@

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.appinfo.MyDataCenterInstanceConfig;
import com.netflix.discovery.DiscoveryManager;
import com.netflix.discovery.EurekaNamespace;

public class MyDataCenterInstanceConfigProvider implements Provider<MyDataCenterInstanceConfig> {
public class MyDataCenterInstanceConfigProvider implements Provider<EurekaInstanceConfig> {
@Inject(optional = true)
@EurekaNamespace
private String namespace;
Expand All @@ -21,7 +22,8 @@ public synchronized MyDataCenterInstanceConfig get() {
} else {
config = new MyDataCenterInstanceConfig(namespace);
}


// TODO: Remove this when DiscoveryManager is finally no longer used
DiscoveryManager.getInstance().setEurekaInstanceConfig(config);
}
return config;
Expand Down
Expand Up @@ -21,6 +21,7 @@
import java.util.Arrays;
import java.util.List;

import com.netflix.governator.guice.lazy.FineGrainedLazySingleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -55,6 +56,7 @@
* @author Karthik Ranganathan
*
*/
@FineGrainedLazySingleton
@ProvidedBy(DefaultEurekaClientConfigProvider.class)
public class DefaultEurekaClientConfig implements EurekaClientConfig {
private static final String ARCHAIUS_DEPLOYMENT_ENVIRONMENT = "archaius.deployment.environment";
Expand Down

0 comments on commit d6ade39

Please sign in to comment.