Search in sources :

Example 1 with NameableExecutor

use of io.mycat.util.NameableExecutor 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 NameableExecutor

use of io.mycat.util.NameableExecutor in project Mycat-Server by MyCATApache.

the class ShowThreadPool method execute.

public static void execute(ManagerConnection c) {
    ByteBuffer buffer = c.allocate();
    // write header
    buffer = header.write(buffer, c, true);
    // write fields
    for (FieldPacket field : fields) {
        buffer = field.write(buffer, c, true);
    }
    // write eof
    buffer = eof.write(buffer, c, true);
    // write rows
    byte packetId = eof.packetId;
    List<NameableExecutor> executors = getExecutors();
    for (NameableExecutor exec : executors) {
        if (exec != null) {
            RowDataPacket row = getRow(exec, c.getCharset());
            row.packetId = ++packetId;
            buffer = row.write(buffer, c, true);
        }
    }
    // write last eof
    EOFPacket lastEof = new EOFPacket();
    lastEof.packetId = ++packetId;
    buffer = lastEof.write(buffer, c, true);
    // write buffer
    c.write(buffer);
}
Also used : NameableExecutor(io.mycat.util.NameableExecutor) RowDataPacket(io.mycat.net.mysql.RowDataPacket) EOFPacket(io.mycat.net.mysql.EOFPacket) ByteBuffer(java.nio.ByteBuffer) FieldPacket(io.mycat.net.mysql.FieldPacket)

Aggregations

NameableExecutor (io.mycat.util.NameableExecutor)2 MycatServer (io.mycat.MycatServer)1 EOFPacket (io.mycat.net.mysql.EOFPacket)1 FieldPacket (io.mycat.net.mysql.FieldPacket)1 RowDataPacket (io.mycat.net.mysql.RowDataPacket)1 ByteBuffer (java.nio.ByteBuffer)1 LinkedList (java.util.LinkedList)1