use of com.alibaba.cobar.util.NameableExecutor in project cobar by alibaba.
the class ShowThreadPool method getExecutors.
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;
}
use of com.alibaba.cobar.util.NameableExecutor in project cobar by alibaba.
the class ShowThreadPool method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
// write eof
buffer = eof.write(buffer, c);
// 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);
}
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
// write buffer
c.write(buffer);
}
Aggregations