use of com.alibaba.cobar.CobarServer in project cobar by alibaba.
the class ShowThreadPool method getExecutors.
private static List<NameableExecutor> getExecutors() {
List<NameableExecutor> list = new LinkedList<NameableExecutor>();
CobarServer server = CobarServer.getInstance();
list.add(server.getInitExecutor());
list.add(server.getTimerExecutor());
list.add(server.getManagerExecutor());
for (NIOProcessor p : server.getProcessors()) {
list.add(p.getHandler());
list.add(p.getExecutor());
list.add(p.getCommitter());
}
return list;
}
use of com.alibaba.cobar.CobarServer in project cobar by alibaba.
the class ShowServer method getRow.
private static RowDataPacket getRow(String charset) {
CobarServer server = CobarServer.getInstance();
long startupTime = server.getStartupTime();
long now = TimeUtil.currentTimeMillis();
long uptime = now - startupTime;
Runtime rt = Runtime.getRuntime();
long total = rt.totalMemory();
long max = rt.maxMemory();
long used = (total - rt.freeMemory());
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(FormatUtil.formatTime(uptime, 3), charset));
row.add(LongUtil.toBytes(used));
row.add(LongUtil.toBytes(total));
row.add(LongUtil.toBytes(max));
row.add(LongUtil.toBytes(server.getConfig().getReloadTime()));
row.add(LongUtil.toBytes(server.getConfig().getRollbackTime()));
row.add(StringUtil.encode(charset, charset));
row.add(StringUtil.encode(CobarServer.getInstance().isOnline() ? "ON" : "OFF", charset));
return row;
}
Aggregations