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


Java ContainerState.restarting方法代码示例

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


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

示例1: getStatus

import com.spotify.docker.client.messages.ContainerState; //导入方法依赖的package包/类
@Override
public InstanceStatus getStatus(String instanceId) {
    ContainerState state;
    try {
        state = dockerClient.inspectContainer(instanceId).state();
    } catch (Exception e) {
        LOG.error("Cannot get state of container " + instanceId, e);
        return InstanceStatus.UNKNOWN;
    }

    if (state.running())
        return InstanceStatus.RUNNING;
    if (state.restarting())
        return InstanceStatus.RESTARTING;
    if (state.oomKilled() || StringUtil.isNotEmpty(state.error()))
        return InstanceStatus.ERROR;
    if (state.finishedAt() != null)
        return InstanceStatus.STOPPED;

    LOG.warn("Could not map state '" + state.toString() + "' to InstanceStatus");
    return InstanceStatus.UNKNOWN;
}
 
开发者ID:carlpett,项目名称:teamcity-container-cloud,代码行数:23,代码来源:DockerSocketContainerProvider.java

示例2: createState

import com.spotify.docker.client.messages.ContainerState; //导入方法依赖的package包/类
private static InstanceState createState(ContainerState state) {
    if (state.running()) {
        return InstanceState.LAUNCHED;
    } else if (state.oomKilled() || (state.error() != null && !state.error().isEmpty())) {
        return InstanceState.ERROR;
    } else if (state.paused()) {
        return InstanceState.PAUSED;
    } else if (state.restarting()) {
        return InstanceState.REBOOTING;
    } else {
        return InstanceState.SHUTOFF; 
    }
}
 
开发者ID:meridor,项目名称:perspective-backend,代码行数:14,代码来源:ListInstancesOperation.java

示例3: refresh

import com.spotify.docker.client.messages.ContainerState; //导入方法依赖的package包/类
@Override
public void refresh(RuntimeId runtimeId) throws RuntimeOperationException {
    DockerRuntime runtime = (DockerRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        ContainerInfo containerInfo = docker.getDockerClient(runtime.getProviderId()).inspectContainer(runtime.getId());
        ContainerState state = containerInfo.state();
        String stateString = STOPPED;
        if (state.running() && !state.paused()) {
            stateString = RUNNING;
        } else if (state.paused()) {
            stateString = "Paused";
        } else if (state.restarting()) {
            stateString = "Restarting";
        } else if (state.oomKilled()) {
            stateString = "Killed";
        }

        DockerRuntime newRuntime = new DockerRuntime(runtime.getId(),
                                                     runtime.getName(),
                                                     runtime.getConfig(),
                                                     runtime.getProviderId(),
                                                     runtime.getEndpoint(),
                                                     runtime.getInfo(),
                                                     new DockerRuntimeState(stateString,
                                                                            state.startedAt().toString()));
        runtimeRegistry.registerRuntime(newRuntime);
    } catch (DockerException | InterruptedException ex) {
        LOG.error("Error Refreshing container: " + runtimeId.getId(),
                  ex);
        throw new RuntimeOperationException("Error Refreshing container: " + runtimeId.getId(),
                                            ex);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:34,代码来源:DockerRuntimeManager.java


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