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

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

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

Instance.getRemoved介绍

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

代码示例

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

@Override
public boolean evaluate(Instance obj) {
  return obj.getRemoved() != null;
}

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

public static String getInstanceName(Instance instance) {
  if (instance != null && instance.getRemoved() == null) {
    return instance.getUuid();
  } else {
    return null;
  }
}

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

@Override
public boolean isError() {
  return this.instance != null && (ERROR_STATES.contains(this.instance.getState()) || this.instance.getRemoved() != null);
}

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

@Override
public boolean evaluate(Instance obj) {
  if ((startOnce && ERROR_STATES.contains(obj.getState()))
      || obj.getRemoved() != null
      || (!startOnce && BAD_ALLOCATING_STATES.contains(obj.getState()))) {
    String error = TransitioningUtils.getTransitioningError(obj);
    String message = "Bad instance [" + key(instance) + "] in state [" + obj.getState() + "]";
    if (StringUtils.isNotBlank(error)) {
      message = message + ": " + error;
    }
    throw new RuntimeException(message);
  }
  return context.objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID,
      instance.getId()).size() > 0;
}

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

@Override
  public List<? extends Instance> getInstances(Object obj) {
    if (!(obj instanceof HealthcheckInstanceHostMap)) {
      return null;
    }
    HealthcheckInstanceHostMap hostMap = (HealthcheckInstanceHostMap) obj;

    List<Instance> instances = new ArrayList<>();
    HealthcheckInstance hInstance = objectManager.loadResource(HealthcheckInstance.class,
        hostMap.getHealthcheckInstanceId());
    if (hInstance == null || hInstance.getRemoved() != null) {
      return instances;
    }

    Instance instance = objectManager.loadResource(Instance.class, hInstance.getInstanceId());

    if (instance != null && instance.getRemoved() == null) {
      instances.add(instance);
    }
    return instances;
  }
}

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

@Override
public boolean evaluate(Instance obj) {
  if (obj.getRemoved() != null) {
    throw new TimeoutException("Instance is removed");
  }
  if (ERROR_STATES.contains(obj.getState())) {
    throw new TimeoutException("Instance encountered an error");
  }
  if (isStartOnce(obj)) {
    return START_ONCE_STATES.contains(obj.getState());
  }
  InstanceHostMap ihm =
      objectManager.findAny(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, obj.getId(), INSTANCE_HOST_MAP.STATE,
          CommonStatesConstants.ACTIVE, INSTANCE_HOST_MAP.REMOVED, null);
  return ihm != null;
}

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

if (instance == null || instance.getRemoved() != null) {
  return null;

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

public void cleanupUpgradedInstances(Service service) {
  List<? extends ServiceExposeMap> maps = exposeMapDao.getInstancesSetForUpgrade(service.getId());
  List<Instance> waitList = new ArrayList<>();
  for (ServiceExposeMap map : maps) {
    Instance instance = objectManager.loadResource(Instance.class, map.getInstanceId());
    if (instance == null || instance.getRemoved() != null || instance.getState().equals(
            CommonStatesConstants.REMOVING)) {
      continue;
    }
    try {
      objectProcessMgr.scheduleProcessInstanceAsync(InstanceConstants.PROCESS_REMOVE,
          instance, null);
    } catch (ProcessCancelException ex) {
      // in case instance was manually restarted
      objectProcessMgr.scheduleProcessInstanceAsync(InstanceConstants.PROCESS_STOP,
          instance, ProcessUtils.chainInData(new HashMap<String, Object>(),
              InstanceConstants.PROCESS_STOP, InstanceConstants.PROCESS_REMOVE));
    }
  }
  for (Instance instance : waitList) {
    resourceMntr.waitForState(instance, CommonStatesConstants.REMOVED);
  }
}

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

List<String> invalidStates = Arrays.asList(CommonStatesConstants.REMOVING, CommonStatesConstants.REMOVED,
    InstanceConstants.STATE_ERRORING, InstanceConstants.STATE_ERROR);
if (instance.getRemoved() != null || invalidStates.contains(instance.getState())) {
  continue;

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

if (i.getRemoved() != null) {
  continue;

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

setState(from.getState());
setCreated(from.getCreated());
setRemoved(from.getRemoved());
setRemoveTime(from.getRemoveTime());
setData(from.getData());

相关文章