本文整理汇总了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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例6: listCommandStatus
import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //导入依赖的package包/类
@Override
public List<CommandStatus> listCommandStatus() {
return getJdbcTemplate().query(SHOW_COMMAND, commandStatusRowMapper);
}
示例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;
}
示例8: listCommandStatus
import com.alibaba.cobar.manager.dataobject.cobarnode.CommandStatus; //导入依赖的package包/类
List<CommandStatus> listCommandStatus();