use of com.actiontech.dble.net.NIOProcessor in project dble by actiontech.
the class ShowSession 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.getPacketId();
for (NIOProcessor process : DbleServer.getInstance().getFrontProcessors()) {
for (FrontendConnection front : process.getFrontends().values()) {
if (!(front instanceof ServerConnection)) {
continue;
}
ServerConnection sc = (ServerConnection) front;
RowDataPacket row = getRow(sc, c.getCharset().getResults());
if (row != null) {
row.setPacketId(++packetId);
buffer = row.write(buffer, c, true);
}
}
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.setPacketId(++packetId);
buffer = lastEof.write(buffer, c, true);
// write buffer
c.write(buffer);
}
use of com.actiontech.dble.net.NIOProcessor in project dble by actiontech.
the class ShowBinlogStatus method getNeedWaitSession.
private static List<NonBlockingSession> getNeedWaitSession() {
List<NonBlockingSession> fcList = new ArrayList<>();
for (NIOProcessor process : DbleServer.getInstance().getFrontProcessors()) {
for (FrontendConnection front : process.getFrontends().values()) {
if (!(front instanceof ServerConnection)) {
continue;
}
ServerConnection sc = (ServerConnection) front;
NonBlockingSession session = sc.getSession2();
if (session.isNeedWaitFinished()) {
fcList.add(session);
}
}
}
return fcList;
}
use of com.actiontech.dble.net.NIOProcessor in project dble by actiontech.
the class ShowConnection 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.getPacketId();
NIOProcessor[] processors = DbleServer.getInstance().getFrontProcessors();
for (NIOProcessor p : processors) {
for (FrontendConnection fc : p.getFrontends().values()) {
if (fc != null) {
RowDataPacket row = getRow(fc, c.getCharset().getResults());
row.setPacketId(++packetId);
buffer = row.write(buffer, c, true);
}
}
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.setPacketId(++packetId);
buffer = lastEof.write(buffer, c, true);
// write buffer
c.write(buffer);
}
use of com.actiontech.dble.net.NIOProcessor in project dble by actiontech.
the class ShowConnectionCount method getRow.
private static RowDataPacket getRow() {
int cons = 0;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
NIOProcessor[] processors = DbleServer.getInstance().getFrontProcessors();
for (NIOProcessor p : processors) {
for (FrontendConnection fc : p.getFrontends().values()) {
if (fc != null) {
cons++;
}
}
}
row.add(IntegerUtil.toBytes(cons));
return row;
}
use of com.actiontech.dble.net.NIOProcessor in project dble by actiontech.
the class ShowConnectionSQL 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.getPacketId();
for (NIOProcessor p : DbleServer.getInstance().getFrontProcessors()) {
for (FrontendConnection fc : p.getFrontends().values()) {
if (!fc.isClosed()) {
RowDataPacket row = getRow(fc, c.getCharset().getResults());
row.setPacketId(++packetId);
buffer = row.write(buffer, c, true);
}
}
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.setPacketId(++packetId);
buffer = lastEof.write(buffer, c, true);
// write buffer
c.write(buffer);
}
Aggregations