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


Java InstanceInfo.InstanceStatus方法代码示例

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


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

示例1: update

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Override
public void update(ApplicationInfoManager manager, InstanceInfo.InstanceStatus status) {
    Preconditions.checkNotNull(manager);
    Preconditions.checkNotNull(status);

    manager.setInstanceStatus(status);
}
 
开发者ID:hazelcast,项目名称:hazelcast-eureka,代码行数:8,代码来源:DefaultUpdater.java

示例2: getStatus

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Override
public InstanceInfo.InstanceStatus getStatus(InstanceInfo.InstanceStatus currentStatus) {
  final String statusCode = aggregateHealth.health().getStatus().getCode();
  if (Status.UP.getCode().equals(statusCode)) {
    return InstanceInfo.InstanceStatus.UP;
  } else if (Status.OUT_OF_SERVICE.getCode().equals(statusCode)) {
    return InstanceInfo.InstanceStatus.OUT_OF_SERVICE;
  } else if (Status.DOWN.getCode().equals(statusCode)) {
    return InstanceInfo.InstanceStatus.DOWN;
  } else {
    return InstanceInfo.InstanceStatus.UNKNOWN;
  }
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:14,代码来源:BootHealthCheckHandler.java

示例3: setStatus

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Override
public void setStatus(EurekaRegistration registration, String status) {
	InstanceInfo info = registration.getApplicationInfoManager().getInfo();

	//TODO: howto deal with delete properly?
	if ("CANCEL_OVERRIDE".equalsIgnoreCase(status)) {
		registration.getEurekaClient().cancelOverrideStatus(info);
		return;
	}

	//TODO: howto deal with status types across discovery systems?
	InstanceInfo.InstanceStatus newStatus = InstanceInfo.InstanceStatus.toEnum(status);
	registration.getEurekaClient().setStatus(newStatus, info);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:15,代码来源:EurekaServiceRegistry.java

示例4: shouldRegisterService

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Test
public void shouldRegisterService() {

	InstanceInfo.InstanceStatus status = this.discoveryClient.getHealthCheckHandler()
			.getStatus(InstanceInfo.InstanceStatus.UNKNOWN);

	assertNotNull(status);
	assertEquals(InstanceInfo.InstanceStatus.OUT_OF_SERVICE, status);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:10,代码来源:EurekaHealthCheckTests.java

示例5: healthCheckHandler

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Bean
public HealthCheckHandler healthCheckHandler() {
	return new HealthCheckHandler() {
		@Override
		public InstanceInfo.InstanceStatus getStatus(
				InstanceInfo.InstanceStatus currentStatus) {
			return InstanceInfo.InstanceStatus.UP;
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:11,代码来源:EurekaSampleApplication.java

示例6: getStatus

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Override
public InstanceInfo.InstanceStatus getStatus(InstanceInfo.InstanceStatus instanceStatus) {
    return getHealthStatus();
}
 
开发者ID:javaguru,项目名称:tcloud-microservices,代码行数:5,代码来源:EurekaServiceApplication.java

示例7: getHealthStatus

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
protected InstanceInfo.InstanceStatus getHealthStatus() {
    final Status status = healthIndicator.health().getStatus();
    return mapToInstanceStatus(status);
}
 
开发者ID:javaguru,项目名称:tcloud-microservices,代码行数:5,代码来源:EurekaServiceApplication.java

示例8: mapToInstanceStatus

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
protected InstanceInfo.InstanceStatus mapToInstanceStatus(Status status) {
    if(!healthStatuses.containsKey(status)) {
        return InstanceInfo.InstanceStatus.UNKNOWN;
    }
    return healthStatuses.get(status);
}
 
开发者ID:javaguru,项目名称:tcloud-microservices,代码行数:7,代码来源:EurekaServiceApplication.java

示例9: update

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Override
public void update(ApplicationInfoManager manager, InstanceInfo.InstanceStatus status) {
}
 
开发者ID:hazelcast,项目名称:hazelcast-eureka,代码行数:4,代码来源:NoopUpdater.java

示例10: setEurekaInstanceStatus

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected void setEurekaInstanceStatus(InstanceInfo.InstanceStatus status) {
    ApplicationInfoManager.getInstance().setInstanceStatus(status);
}
 
开发者ID:Nike-Inc,项目名称:riposte,代码行数:5,代码来源:EurekaHandler.java

示例11: create

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
public InstanceInfo create(EurekaInstanceConfig config) {
	LeaseInfo.Builder leaseInfoBuilder = LeaseInfo.Builder.newBuilder()
			.setRenewalIntervalInSecs(config.getLeaseRenewalIntervalInSeconds())
			.setDurationInSecs(config.getLeaseExpirationDurationInSeconds());

	// Builder the instance information to be registered with eureka
	// server
	InstanceInfo.Builder builder = InstanceInfo.Builder.newBuilder();

	String namespace = config.getNamespace();
	if (!namespace.endsWith(".")) {
		namespace = namespace + ".";
	}
	builder.setNamespace(namespace).setAppName(config.getAppname())
			.setInstanceId(config.getInstanceId())
			.setAppGroupName(config.getAppGroupName())
			.setDataCenterInfo(config.getDataCenterInfo())
			.setIPAddr(config.getIpAddress()).setHostName(config.getHostName(false))
			.setPort(config.getNonSecurePort())
			.enablePort(InstanceInfo.PortType.UNSECURE,
					config.isNonSecurePortEnabled())
			.setSecurePort(config.getSecurePort())
			.enablePort(InstanceInfo.PortType.SECURE, config.getSecurePortEnabled())
			.setVIPAddress(config.getVirtualHostName())
			.setSecureVIPAddress(config.getSecureVirtualHostName())
			.setHomePageUrl(config.getHomePageUrlPath(), config.getHomePageUrl())
			.setStatusPageUrl(config.getStatusPageUrlPath(),
					config.getStatusPageUrl())
			.setHealthCheckUrls(config.getHealthCheckUrlPath(),
					config.getHealthCheckUrl(), config.getSecureHealthCheckUrl())
			.setASGName(config.getASGName());

	// Start off with the STARTING state to avoid traffic
	if (!config.isInstanceEnabledOnit()) {
		InstanceInfo.InstanceStatus initialStatus = InstanceInfo.InstanceStatus.STARTING;
		if (log.isInfoEnabled()) {
			log.info("Setting initial instance status as: " + initialStatus);
		}
		builder.setStatus(initialStatus);
	}
	else {
		if (log.isInfoEnabled()) {
			log.info("Setting initial instance status as: "
					+ InstanceInfo.InstanceStatus.UP
					+ ". This may be too early for the instance to advertise itself as available. "
					+ "You would instead want to control this via a healthcheck handler.");
		}
	}

	// Add any user-specific metadata information
	for (Map.Entry<String, String> mapEntry : config.getMetadataMap().entrySet()) {
		String key = mapEntry.getKey();
		String value = mapEntry.getValue();
		builder.add(key, value);
	}

	InstanceInfo instanceInfo = builder.build();
	instanceInfo.setLeaseInfo(leaseInfoBuilder.build());
	return instanceInfo;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:61,代码来源:InstanceInfoFactory.java

示例12: update

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
void update(ApplicationInfoManager manager, InstanceInfo.InstanceStatus status); 
开发者ID:hazelcast,项目名称:hazelcast-eureka,代码行数:2,代码来源:StatusChangeStrategy.java

示例13: getInitialStatus

import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
InstanceInfo.InstanceStatus getInitialStatus(); 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:2,代码来源:CloudEurekaInstanceConfig.java


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