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


Java Status.Alert方法代码示例

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


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

示例1: investigate

import com.cloud.host.Status; //导入方法依赖的package包/类
protected Status investigate(final AgentAttache agent) {
    final Long hostId = agent.getId();
    final HostVO host = _hostDao.findById(hostId);
    if (host != null && host.getType() != null && !host.getType().isVirtual()) {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("checking if agent (" + hostId + ") is alive");
        }
        final Answer answer = easySend(hostId, new CheckHealthCommand());
        if (answer != null && answer.getResult()) {
            final Status status = Status.Up;
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
            }
            return status;
        }
        return _haMgr.investigate(hostId);
    }
    return Status.Alert;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:20,代码来源:AgentManagerImpl.java

示例2: investigate

import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public Status investigate(final long hostId) {
    final HostVO host = _hostDao.findById(hostId);
    if (host == null) {
        return Status.Alert;
    }

    Status hostState = null;
    for (final Investigator investigator : investigators) {
        hostState = investigator.isAgentAlive(host);
        if (hostState != null) {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug(investigator.getName() + " was able to determine host " + hostId + " is in " + hostState.toString());
            }
            return hostState;
        }
        if (s_logger.isDebugEnabled()) {
            s_logger.debug(investigator.getName() + " unable to determine the state of the host.  Moving on.");
        }
    }

    return hostState;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:24,代码来源:HighAvailabilityManagerImpl.java

示例3: reconnect

import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public boolean reconnect(final long hostId) {
    final HostVO host;

    host = _hostDao.findById(hostId);
    if (host == null || host.getRemoved() != null) {
        s_logger.warn("Unable to find host " + hostId);
        return false;
    }

    if (host.getStatus() == Status.Disconnected) {
        s_logger.info("Host is already disconnected, no work to be done");
        return true;
    }

    if (host.getStatus() != Status.Up && host.getStatus() != Status.Alert && host.getStatus() != Status.Rebalancing) {
        s_logger.info("Unable to disconnect host because it is not in the correct state: host=" + hostId + "; Status=" + host.getStatus());
        return false;
    }

    final AgentAttache attache = findAttache(hostId);
    if (attache == null) {
        s_logger.info("Unable to disconnect host because it is not connected to this server: " + hostId);
        return false;
    }

    disconnectWithoutInvestigation(attache, Event.ShutdownRequested);
    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:30,代码来源:AgentManagerImpl.java

示例4: handleDisconnectWithoutInvestigation

import com.cloud.host.Status; //导入方法依赖的package包/类
protected boolean handleDisconnectWithoutInvestigation(final AgentAttache attache, final Status.Event event, final boolean transitState, final boolean removeAgent) {
    final long hostId = attache.getId();

    s_logger.info("Host " + hostId + " is disconnecting with event " + event);
    Status nextStatus = null;
    final HostVO host = _hostDao.findById(hostId);
    if (host == null) {
        s_logger.warn("Can't find host with " + hostId);
        nextStatus = Status.Removed;
    } else {
        final Status currentStatus = host.getStatus();
        if (currentStatus == Status.Down || currentStatus == Status.Alert || currentStatus == Status.Removed) {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("Host " + hostId + " is already " + currentStatus);
            }
            nextStatus = currentStatus;
        } else {
            try {
                nextStatus = currentStatus.getNextStatus(event);
            } catch (final NoTransitionException e) {
                final String err = "Cannot find next status for " + event + " as current status is " + currentStatus + " for agent " + hostId;
                s_logger.debug(err);
                throw new CloudRuntimeException(err);
            }

            if (s_logger.isDebugEnabled()) {
                s_logger.debug("The next status of agent " + hostId + "is " + nextStatus + ", current status is " + currentStatus);
            }
        }
    }

    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Deregistering link for " + hostId + " with state " + nextStatus);
    }

    removeAgent(attache, nextStatus);
    // update the DB
    if (host != null && transitState) {
        disconnectAgent(host, event, _nodeId);
    }

    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:44,代码来源:AgentManagerImpl.java


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