当前位置: 首页>>代码示例>>Java>>正文


Java Applications.getRegisteredApplications方法代码示例

本文整理汇总了Java中com.netflix.discovery.shared.Applications.getRegisteredApplications方法的典型用法代码示例。如果您正苦于以下问题:Java Applications.getRegisteredApplications方法的具体用法?Java Applications.getRegisteredApplications怎么用?Java Applications.getRegisteredApplications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.netflix.discovery.shared.Applications的用法示例。


在下文中一共展示了Applications.getRegisteredApplications方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServices

import com.netflix.discovery.shared.Applications; //导入方法依赖的package包/类
@Override
public List<String> getServices() {
	Applications applications = this.eurekaClient.getApplications();
	if (applications == null) {
		return Collections.emptyList();
	}
	List<Application> registered = applications.getRegisteredApplications();
	List<String> names = new ArrayList<>();
	for (Application app : registered) {
		if (app.getInstances().isEmpty()) {
			continue;
		}
		names.add(app.getName().toLowerCase());

	}
	return names;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:18,代码来源:EurekaDiscoveryClient.java

示例2: getEurekaDetails

import com.netflix.discovery.shared.Applications; //导入方法依赖的package包/类
@GET
public Response getEurekaDetails() {
    List<EurekaInstanceInfo> instanceInfoList = new ArrayList<EurekaInstanceInfo>();

    DiscoveryClient discoveryClient = DiscoveryManager.getInstance().getDiscoveryClient();
    if (null != discoveryClient) {
        Applications apps = discoveryClient.getApplications();
        for (Application app : apps.getRegisteredApplications()) {
            for (InstanceInfo inst : app.getInstances()) {
                instanceInfoList.add(new EurekaInstanceInfo(inst.getAppName(), inst.getId(), inst.getStatus().name(), inst.getIPAddr(), inst.getHostName()));
            }
        }
    }

    GsonBuilder gsonBuilder = new GsonBuilder().serializeNulls();
    Gson gson = gsonBuilder.create();
    String response = gson.toJson(new KaryonAdminResponse(instanceInfoList));
    return Response.ok(response).build();
}
 
开发者ID:Netflix,项目名称:karyon,代码行数:20,代码来源:EurekaResource.java

示例3: getApplications

import com.netflix.discovery.shared.Applications; //导入方法依赖的package包/类
private Map<String, Object> getApplications() {
	Applications applications = this.eurekaClient.getApplications();
	if (applications == null) {
		return Collections.emptyMap();
	}
	Map<String, Object> result = new HashMap<>();
	for (Application application : applications.getRegisteredApplications()) {
		result.put(application.getName(), application.getInstances().size());
	}
	return result;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:EurekaHealthIndicator.java

示例4: getClusterNames

import com.netflix.discovery.shared.Applications; //导入方法依赖的package包/类
@Override
public List<String> getClusterNames() {
	Applications applications = eurekaClient.getApplications();
	List<Application> registeredApplications = applications.getRegisteredApplications();
	List<String> appNames = new ArrayList<>(registeredApplications.size());
	for (Application application : registeredApplications) {
		appNames.add(application.getName());
	}
	log.trace("Using clusters names: " + appNames);
	return appNames;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:EurekaBasedTurbineClustersProvider.java


注:本文中的com.netflix.discovery.shared.Applications.getRegisteredApplications方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。