本文整理汇总了Java中com.alibaba.cobar.CobarServer.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java CobarServer.getInstance方法的具体用法?Java CobarServer.getInstance怎么用?Java CobarServer.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.cobar.CobarServer
的用法示例。
在下文中一共展示了CobarServer.getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRow
import com.alibaba.cobar.CobarServer; //导入方法依赖的package包/类
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(StringUtil.encode(charset, charset));
row.add(StringUtil.encode(CobarServer.getInstance().isOnline() ? "ON" : "OFF", charset));
return row;
}
示例2: getRow
import com.alibaba.cobar.CobarServer; //导入方法依赖的package包/类
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;
}
示例3: getExecutors
import com.alibaba.cobar.CobarServer; //导入方法依赖的package包/类
private static List<NameableExecutor> getExecutors() {
List<NameableExecutor> list = new LinkedList<NameableExecutor>();
CobarServer server = CobarServer.getInstance();
list.add(server.getTimerExecutor());
list.add(server.getManagerExecutor());
list.add(server.getServerExectuor());
for (NIOProcessor p : server.getProcessors()) {
list.add(p.getHandler());
}
return list;
}
示例4: getExecutors
import com.alibaba.cobar.CobarServer; //导入方法依赖的package包/类
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;
}