use of com.actiontech.dble.net.FrontendConnection in project dble by actiontech.
the class KillConnection method response.
public static void response(String stmt, int offset, ManagerConnection mc) {
int count = 0;
List<FrontendConnection> list = getList(stmt, offset, mc);
if (list != null) {
for (FrontendConnection c : list) {
StringBuilder s = new StringBuilder();
LOGGER.info(s.append(c).append("killed by manager").toString());
c.killAndClose("kill by manager");
count++;
}
}
OkPacket packet = new OkPacket();
packet.setPacketId(1);
packet.setAffectedRows(count);
packet.setServerStatus(2);
packet.write(mc);
}
use of com.actiontech.dble.net.FrontendConnection 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.FrontendConnection 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.FrontendConnection 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.FrontendConnection 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;
}
Aggregations