io.cattle.platform.core.model.Instance.getHealthState()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中io.cattle.platform.core.model.Instance.getHealthState()方法的一些代码示例,展示了Instance.getHealthState()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instance.getHealthState()方法的具体详情如下:
包路径:io.cattle.platform.core.model.Instance
类名称:Instance
方法名:getHealthState

Instance.getHealthState介绍

[英]Getter for cattle.instance.health_state.
[中]cattle.instance.health_state的Getter。

代码示例

代码示例来源:origin: rancher/cattle

@Override
public boolean isUnhealthy() {
  if (instance != null) {
    if (instance.getHealthState() == null) {
      return false;
    }
    boolean unhealthyState = instance.getHealthState().equalsIgnoreCase(
        HealthcheckConstants.HEALTH_STATE_UNHEALTHY) || instance.getHealthState().equalsIgnoreCase(
        HealthcheckConstants.HEALTH_STATE_UPDATING_UNHEALTHY);
    return unhealthyState;
  }
  return false;
}

代码示例来源:origin: rancher/cattle

@Override
public boolean isHealthCheckInitializing() {
  return instance != null && instance.getHealthState() != null
      && HealthcheckConstants.isInit(instance.getHealthState());
}

代码示例来源:origin: rancher/cattle

protected String getHealthState(HealthcheckInstance hcInstance) {
  Instance instance = objectManager.loadResource(Instance.class, hcInstance.getInstanceId());
  return instance == null ? null : instance.getHealthState();
}

代码示例来源:origin: rancher/cattle

@Override
public HandlerResult handle(ProcessState state, ProcessInstance process) {
  Instance instance = (Instance) state.getResource();
  InstanceHealthCheck healthCheck = DataAccessor.field(instance,
      InstanceConstants.FIELD_HEALTH_CHECK, jsonMapper, InstanceHealthCheck.class);
  // set healthcheck
  if (healthCheck != null) {
    if (instance.getHealthState() == null) {
      objectManager.setFields(instance, INSTANCE.HEALTH_STATE,
          HealthcheckConstants.HEALTH_STATE_INITIALIZING, INSTANCE.HEALTH_UPDATED, new Date());
    } else if (instance.getHealthState().equalsIgnoreCase(HealthcheckConstants.HEALTH_STATE_HEALTHY)) {
      healtcheckService.updateInstanceHealthState(instance, HealthcheckConstants.HEALTH_STATE_REINITIALIZING);
    }
    healtcheckService.registerForHealtcheck(HealthcheckInstanceType.INSTANCE, instance.getId());
  }
  return null;
}

代码示例来源:origin: rancher/cattle

protected boolean needToRemove(Instance instance) {
  boolean remove = false;
  InstanceHealthCheck healthCheck = DataAccessor.field(instance,
      InstanceConstants.FIELD_HEALTH_CHECK, jsonMapper, InstanceHealthCheck.class);
  if(healthCheck.getStrategy() == Strategy.none) {
      return remove;
  }
  Integer timeout;
  if (instance.getHealthState().equalsIgnoreCase(HealthcheckConstants.HEALTH_STATE_INITIALIZING)) {
    timeout = healthCheck.getInitializingTimeout();
  } else {
    timeout = healthCheck.getReinitializingTimeout();
  }
  
  if (timeout != null && instance.getHealthUpdated() != null) {
    long createdTimeAgo = System.currentTimeMillis() - instance.getHealthUpdated().getTime();
    if (createdTimeAgo >= timeout) {
      remove = true;
    }
  }
  return remove;
}

代码示例来源:origin: rancher/cattle

List<String> runningStates = Arrays.asList(InstanceConstants.STATE_RUNNING);
for (Instance instance : serviceInstances) {
  String iHS = instance.getHealthState() == null ? HealthcheckConstants.HEALTH_STATE_HEALTHY : instance
      .getHealthState().toLowerCase();
  if (runningStates.contains(instance.getState().toLowerCase())) {
    if (healthyStates.contains(iHS)) {

代码示例来源:origin: rancher/cattle

this.health_state = instance.getHealthState();
this.start_count = instance.getStartCount();
this.state = instance.getState();

代码示例来源:origin: rancher/cattle

setNativeContainer(from.getNativeContainer());
setNetworkContainerId(from.getNetworkContainerId());
setHealthState(from.getHealthState());
setStartCount(from.getStartCount());
setCreateIndex(from.getCreateIndex());

相关文章