use of com.netflix.appinfo.InstanceInfo in project eureka by Netflix.
the class EurekaEntityComparators method equal.
public static boolean equal(Application first, Application second) {
if (first == second) {
return true;
}
if (first == null || first == null && second != null) {
return false;
}
if (first.getName() != null ? !first.getName().equals(second.getName()) : second.getName() != null) {
return false;
}
List<InstanceInfo> firstInstanceInfos = first.getInstances();
List<InstanceInfo> secondInstanceInfos = second.getInstances();
if (firstInstanceInfos == null && secondInstanceInfos == null) {
return true;
}
if (firstInstanceInfos == null || secondInstanceInfos == null || firstInstanceInfos.size() != secondInstanceInfos.size()) {
return false;
}
for (InstanceInfo firstInstanceInfo : firstInstanceInfos) {
InstanceInfo secondInstanceInfo = second.getByInstanceId(firstInstanceInfo.getId());
if (!equal(firstInstanceInfo, secondInstanceInfo)) {
return false;
}
}
return true;
}
use of com.netflix.appinfo.InstanceInfo in project eureka by Netflix.
the class EurekaEntityFunctions method copyInstances.
public static void copyInstances(Collection<InstanceInfo> instances, Applications result) {
if (instances != null) {
for (InstanceInfo instance : instances) {
Application app = result.getRegisteredApplications(instance.getAppName());
if (app == null) {
app = new Application(instance.getAppName());
result.addApplication(app);
}
app.addInstance(instance);
}
}
}
use of com.netflix.appinfo.InstanceInfo in project eureka by Netflix.
the class EurekaEntityFunctions method toApplications.
public static Applications toApplications(List<InstanceInfo> instances) {
Applications result = new Applications();
for (InstanceInfo instance : instances) {
Application app = result.getRegisteredApplications(instance.getAppName());
if (app == null) {
app = new Application(instance.getAppName());
result.addApplication(app);
}
app.addInstance(instance);
}
return updateMeta(result);
}
use of com.netflix.appinfo.InstanceInfo in project eureka by Netflix.
the class EurekaEntityFunctions method copyInstance.
public static InstanceInfo copyInstance(InstanceInfo original, ActionType actionType) {
InstanceInfo copy = new InstanceInfo(original);
copy.setActionType(actionType);
return copy;
}
use of com.netflix.appinfo.InstanceInfo in project eureka by Netflix.
the class ApplicationsResolver method getClusterEndpoints.
@Override
public List<AwsEndpoint> getClusterEndpoints() {
List<AwsEndpoint> result = new ArrayList<>();
Applications applications = applicationsSource.getApplications(transportConfig.getApplicationsResolverDataStalenessThresholdSeconds(), TimeUnit.SECONDS);
if (applications != null && vipAddress != null) {
List<InstanceInfo> validInstanceInfos = applications.getInstancesByVirtualHostName(vipAddress);
for (InstanceInfo instanceInfo : validInstanceInfos) {
if (instanceInfo.getStatus() == InstanceInfo.InstanceStatus.UP) {
AwsEndpoint endpoint = ResolverUtils.instanceInfoToEndpoint(clientConfig, transportConfig, instanceInfo);
if (endpoint != null) {
result.add(endpoint);
}
}
}
}
logger.debug("Retrieved endpoint list {}", result);
return result;
}
Aggregations