Search in sources :

Example 6 with NonBlockingSession

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;
}
Also used : BackendConnection(com.actiontech.dble.backend.BackendConnection) RowDataPacket(com.actiontech.dble.net.mysql.RowDataPacket) NonBlockingSession(com.actiontech.dble.server.NonBlockingSession)

Aggregations

NonBlockingSession (com.actiontech.dble.server.NonBlockingSession)6 BackendConnection (com.actiontech.dble.backend.BackendConnection)1 FrontendConnection (com.actiontech.dble.net.FrontendConnection)1 NIOProcessor (com.actiontech.dble.net.NIOProcessor)1 RowDataPacket (com.actiontech.dble.net.mysql.RowDataPacket)1 ServerConnection (com.actiontech.dble.server.ServerConnection)1