use of io.mycat.MycatServer in project Mycat-Server by MyCATApache.
the class ShowThreadPool method getExecutors.
private static List<NameableExecutor> getExecutors() {
List<NameableExecutor> list = new LinkedList<NameableExecutor>();
MycatServer server = MycatServer.getInstance();
list.add(server.getTimerExecutor());
// list.add(server.getAioExecutor());
list.add(server.getBusinessExecutor());
// }
return list;
}
use of io.mycat.MycatServer in project Mycat-Server by MyCATApache.
the class ShowServer method getRow.
private static RowDataPacket getRow(String charset) {
MycatServer server = MycatServer.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(MycatServer.getInstance().isOnline() ? "ON" : "OFF", charset));
return row;
}
use of io.mycat.MycatServer in project Mycat-Server by MyCATApache.
the class AbstractDataNodeMerge method addPack.
/**
* Add a row pack, and may be wake up a business thread to work if not running.
* @param pack row pack
* @return true wake up a business thread, otherwise false
*
* @author Uncle-pan
* @since 2016-03-23
*/
protected final boolean addPack(final PackWraper pack) {
packs.add(pack);
if (running.get()) {
return false;
}
final MycatServer server = MycatServer.getInstance();
server.getBusinessExecutor().execute(this);
return true;
}
Aggregations