本文整理汇总了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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
};
}
示例6: getStatus
import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Override
public InstanceInfo.InstanceStatus getStatus(InstanceInfo.InstanceStatus instanceStatus) {
return getHealthStatus();
}
示例7: getHealthStatus
import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
protected InstanceInfo.InstanceStatus getHealthStatus() {
final Status status = healthIndicator.health().getStatus();
return mapToInstanceStatus(status);
}
示例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);
}
示例9: update
import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@Override
public void update(ApplicationInfoManager manager, InstanceInfo.InstanceStatus status) {
}
示例10: setEurekaInstanceStatus
import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected void setEurekaInstanceStatus(InstanceInfo.InstanceStatus status) {
ApplicationInfoManager.getInstance().setInstanceStatus(status);
}
示例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;
}
示例12: update
import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
void update(ApplicationInfoManager manager, InstanceInfo.InstanceStatus status);
示例13: getInitialStatus
import com.netflix.appinfo.InstanceInfo; //导入方法依赖的package包/类
InstanceInfo.InstanceStatus getInitialStatus();