use of com.actiontech.dble.server.NonBlockingSession in project dble by actiontech.
the class ShowSession method getRow.
private static RowDataPacket getRow(ServerConnection sc, String charset) {
StringBuilder sb = new StringBuilder();
NonBlockingSession session = sc.getSession2();
Collection<BackendConnection> backConnections = session.getTargetMap().values();
int cnCount = backConnections.size();
if (cnCount == 0) {
return null;
}
for (BackendConnection backCon : backConnections) {
sb.append(backCon).append("\r\n");
}
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(sc.getId() + "", charset));
row.add(StringUtil.encode(cnCount + "", charset));
row.add(StringUtil.encode(sb.toString(), charset));
return row;
}
Aggregations