Search in sources :

Example 1 with DbleServer

use of com.actiontech.dble.DbleServer in project dble by actiontech.

the class ShowServer method getRow.

private static RowDataPacket getRow(String charset) {
    DbleServer server = DbleServer.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(FormatUtil.formatDate(server.getConfig().getReloadTime()), charset));
    row.add(LongUtil.toBytes(server.getConfig().getRollbackTime()));
    row.add(StringUtil.encode(charset, charset));
    row.add(StringUtil.encode(DbleServer.getInstance().isOnline() ? "ON" : "OFF", charset));
    return row;
}
Also used : DbleServer(com.actiontech.dble.DbleServer) RowDataPacket(com.actiontech.dble.net.mysql.RowDataPacket)

Example 2 with DbleServer

use of com.actiontech.dble.DbleServer in project dble by actiontech.

the class ShowThreadPool method getExecutors.

private static List<ExecutorService> getExecutors() {
    List<ExecutorService> list = new LinkedList<>();
    DbleServer server = DbleServer.getInstance();
    list.add(server.getTimerExecutor());
    list.add(server.getBusinessExecutor());
    list.add(server.getBackendBusinessExecutor());
    list.add(server.getComplexQueryExecutor());
    // }
    return list;
}
Also used : DbleServer(com.actiontech.dble.DbleServer) ExecutorService(java.util.concurrent.ExecutorService) LinkedList(java.util.LinkedList)

Aggregations

DbleServer (com.actiontech.dble.DbleServer)2 RowDataPacket (com.actiontech.dble.net.mysql.RowDataPacket)1 LinkedList (java.util.LinkedList)1 ExecutorService (java.util.concurrent.ExecutorService)1