當前位置: 首頁>>代碼示例>>Java>>正文


Java CommandStatus類代碼示例

本文整理匯總了Java中com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus的典型用法代碼示例。如果您正苦於以下問題:Java CommandStatus類的具體用法?Java CommandStatus怎麽用?Java CommandStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CommandStatus類屬於com.alibaba.cobar.manager.dataobject.cobarnode包,在下文中一共展示了CommandStatus類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mapRow

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
@Override
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
    CommandStatus cmd = new CommandStatus();
    cmd.setProcessorId(rs.getString(CMD_PROCESSOR));
    cmd.setQuery(rs.getLong(QUERY));
    cmd.setStmtExecute(rs.getLong(STMT_EXECUTE));
    cmd.setStmtPrepared(rs.getLong(STMT_PREPARED));
    cmd.setStmtClose(rs.getLong(STMT_CLOSE));
    cmd.setQuit(rs.getLong(QUIT));
    cmd.setPing(rs.getLong(PING));
    cmd.setOther(rs.getLong(OTHER));
    cmd.setKill(rs.getLong(KILL));
    cmd.setInitDB(rs.getLong(INIT_DB));
    cmd.setSampleTimeStamp(System.currentTimeMillis());
    return cmd;
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:17,代碼來源:CobarAdapter.java

示例2: statistic

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
public void statistic() {
    initDBNum = 0;
    queryNum = 0;
    stmtPrepareNum = 0;
    stmtExcuteNum = 0;
    stmtClosed = 0;
    pingNum = 0;
    killNum = 0;
    quitNum = 0;
    otherNum = 0;

    commandList = cobarAdapter.listCommandStatus();
    for (CommandStatus command : commandList) {
        initDBNum += command.getInitDB();
        queryNum += command.getQuery();
        stmtPrepareNum += command.getStmtPrepared();
        stmtExcuteNum += command.getStmtExecute();
        stmtClosed += command.getStmtClose();
        pingNum += command.getPing();
        killNum += command.getKill();
        quitNum += command.getQuit();
        otherNum += command.getOther();
    }

}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:26,代碼來源:TestCommands.java

示例3: groupByCList

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
private long groupByCList(List<CommandStatus> list, int type) {
    long result = 0;
    switch (type) {
        case REQUEST_COUNT:
            for (CommandStatus p : list) {
                result += p.getQuery();
            }
            break;
        default:
            throw new IllegalArgumentException("invalid parameter");
    }
    return result;
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:14,代碼來源:ClusterInstantPerfValueAjax.java

示例4: groupByCList

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
private long groupByCList(List<CommandStatus> list, int type) {
    long result = 0;
    switch (type) {
    case REQUEST_COUNT:
        for (CommandStatus p : list) {
            result += p.getQuery();
        }
        break;
    default:
        throw new IllegalArgumentException("invalid parameter");
    }
    return result;
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:14,代碼來源:ClusterInstantPerfValueAjax.java

示例5: getClusterInfo

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
private AjaxResult getClusterInfo(AjaxParams params) {
    JSONArray array = params.getArray();
    long clusterId = params.getClusterId();

    JSONObject json = null;
    if (array.size() > 0) {
        json = array.getJSONObject(0);
    }

    AjaxResult rs = new AjaxResult();
    rs.setId(clusterId);

    List<CobarDO> nodes = xmlAccesser.getCobarDAO().getCobarList(clusterId);
    rs.setTotal(nodes.size());
    for (CobarDO cobar : nodes) {
        if (ConstantDefine.IN_ACTIVE.equals(cobar.getStatus())) {
            continue;
        }
        CobarAdapterDAO perfAccesser = cobarAccesser.getAccesser(cobar.getId());
        if (!perfAccesser.checkConnection()) {
            rs.addError(1);
            StringBuilder sb = new StringBuilder("getClusterInfo : cobar connect error for [ Name:");
            sb.append(cobar.getName()).append(" Host:").append(cobar.getHost()).append(" ]");
            logger.error(sb.toString());
            continue;
        }
        rs.addActive(1);
        rs.setSchema(perfAccesser.listDataBases().size());
        List<ProcessorStatus> list = perfAccesser.listProccessorStatus();
        rs.addNetIn(groupByPList(list, NET_IN));
        rs.addNetOut(groupByPList(list, NET_OUT));

        rs.addConnection(groupByPList(list, CONNECTION));
        rs.setTimestamp(list.get(list.size() - 1).getSampleTimeStamp());

        List<CommandStatus> commandList = perfAccesser.listCommandStatus();
        rs.addRequest(groupByCList(commandList, REQUEST_COUNT));
    }

    if (json != null && json.getLong("netIn") != -1) {
        long o_tiemstamp = json.getLong("timestamp");
        rs.setNetIn_deriv(FormatUtil.formatNetwork(Math.round(MathUtil.getDerivate(rs.getNetIn(),
            json.getLong("netIn"),
            rs.getTimestamp(),
            o_tiemstamp,
            1000.0))));
        rs.setNetOut_deriv(FormatUtil.formatNetwork(Math.round(MathUtil.getDerivate(rs.getNetOut(),
            json.getLong("netOut"),
            rs.getTimestamp(),
            o_tiemstamp,
            1000.0))));
        rs.setRequest_deriv(FormatUtil.formatNumber(Math.round(MathUtil.getDerivate(rs.getRequest(),
            json.getLong("reCount"),
            rs.getTimestamp(),
            o_tiemstamp,
            1000.0))));
    }

    return rs;
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:61,代碼來源:ClusterInstantPerfValueAjax.java

示例6: listCommandStatus

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
@Override
public List<CommandStatus> listCommandStatus() {
    return getJdbcTemplate().query(SHOW_COMMAND, commandStatusRowMapper);
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:5,代碼來源:CobarAdapter.java

示例7: getClusterInfo

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
private AjaxResult getClusterInfo(AjaxParams params) {
    JSONArray array = params.getArray();
    long clusterId = params.getClusterId();

    JSONObject json = null;
    if (array.size() > 0) {
        json = array.getJSONObject(0);
    }

    AjaxResult rs = new AjaxResult();
    rs.setId(clusterId);

    List<CobarDO> nodes = xmlAccesser.getCobarDAO().getCobarList(clusterId);
    rs.setTotal(nodes.size());
    for (CobarDO cobar : nodes) {
        if (ConstantDefine.IN_ACTIVE.equals(cobar.getStatus())) {
            continue;
        }
        CobarAdapterDAO perfAccesser = cobarAccesser.getAccesser(cobar.getId());
        if (!perfAccesser.checkConnection()) {
            rs.addError(1);
            StringBuilder sb = new StringBuilder("getClusterInfo : cobar connect error for [ Name:");
            sb.append(cobar.getName()).append(" Host:").append(cobar.getHost()).append(" ]");
            logger.error(sb.toString());
            continue;
        }
        rs.addActive(1);
        rs.setSchema(perfAccesser.listDataBases().size());
        List<ProcessorStatus> list = perfAccesser.listProccessorStatus();
        rs.addNetIn(groupByPList(list, NET_IN));
        rs.addNetOut(groupByPList(list, NET_OUT));

        rs.addConnection(groupByPList(list, CONNECTION));
        rs.setTimestamp(list.get(list.size() - 1).getSampleTimeStamp());

        List<CommandStatus> commandList = perfAccesser.listCommandStatus();
        rs.addRequest(groupByCList(commandList, REQUEST_COUNT));
    }

    if (json != null && json.getLong("netIn") != -1) {
        long o_tiemstamp = json.getLong("timestamp");
        rs.setNetIn_deriv(FormatUtil.formatNetwork(Math.round(MathUtil.getDerivate(rs.getNetIn(),
                                                                                   json.getLong("netIn"),
                                                                                   rs.getTimestamp(),
                                                                                   o_tiemstamp,
                                                                                   1000.0))));
        rs.setNetOut_deriv(FormatUtil.formatNetwork(Math.round(MathUtil.getDerivate(rs.getNetOut(),
                                                                                    json.getLong("netOut"),
                                                                                    rs.getTimestamp(),
                                                                                    o_tiemstamp,
                                                                                    1000.0))));
        rs.setRequest_deriv(FormatUtil.formatNumber(Math.round(MathUtil.getDerivate(rs.getRequest(),
                                                                                    json.getLong("reCount"),
                                                                                    rs.getTimestamp(),
                                                                                    o_tiemstamp,
                                                                                    1000.0))));
    }

    return rs;
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:61,代碼來源:ClusterInstantPerfValueAjax.java

示例8: listCommandStatus

import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //導入依賴的package包/類
List<CommandStatus> listCommandStatus(); 
開發者ID:loye168,項目名稱:tddl5,代碼行數:2,代碼來源:CobarAdapterDAO.java


注:本文中的com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。