Search in sources :

Example 1 with MycatServer

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;
}
Also used : NameableExecutor(io.mycat.util.NameableExecutor) LinkedList(java.util.LinkedList) MycatServer(io.mycat.MycatServer)

Example 2 with MycatServer

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;
}
Also used : RowDataPacket(io.mycat.net.mysql.RowDataPacket) MycatServer(io.mycat.MycatServer)

Example 3 with MycatServer

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;
}
Also used : MycatServer(io.mycat.MycatServer)

Aggregations

MycatServer (io.mycat.MycatServer)3 RowDataPacket (io.mycat.net.mysql.RowDataPacket)1 NameableExecutor (io.mycat.util.NameableExecutor)1 LinkedList (java.util.LinkedList)1