use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class ShowDatasourceSyn method response.
public static void response(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 (RowDataPacket row : getRows(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);
// post write
c.write(buffer);
}
use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class ShowDatasourceSynDetail method response.
public static void response(ManagerConnection c, String stmt) {
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();
String name = ManagerParseShow.getWhereParameter(stmt);
for (RowDataPacket row : getRows(name, 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);
// post write
c.write(buffer);
}
use of com.actiontech.dble.net.mysql.FieldPacket in project dble by actiontech.
the class ShowDirectMemory method showDirectMemoryDetail.
private static void showDirectMemoryDetail(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = DETAIL_HEADER.write(buffer, c, true);
// write fields
for (FieldPacket field : DETAIL_FIELDS) {
buffer = field.write(buffer, c, true);
}
// write eof
buffer = DETAIL_EOF.write(buffer, c, true);
// write rows
byte packetId = DETAIL_EOF.getPacketId();
ConcurrentMap<Long, Long> networkBufferPool = DbleServer.getInstance().getBufferPool().getNetDirectMemoryUsage();
for (Map.Entry<Long, Long> entry : networkBufferPool.entrySet()) {
RowDataPacket row = new RowDataPacket(DETAIL_FIELD_COUNT);
long value = entry.getValue();
row.add(StringUtil.encode(String.valueOf(entry.getKey()), c.getCharset().getResults()));
/* DIRECT_MEMORY belong to Buffer Pool */
row.add(StringUtil.encode("NetWorkBufferPool", c.getCharset().getResults()));
row.add(StringUtil.encode(value > 0 ? JavaUtils.bytesToString2(value) : "0", 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.mysql.FieldPacket in project dble by actiontech.
the class ShowDirectMemory method showDirectMemoryTotal.
private static void showDirectMemoryTotal(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = TOTAL_HEADER.write(buffer, c, true);
// write fields
for (FieldPacket field : TOTAL_FIELDS) {
buffer = field.write(buffer, c, true);
}
// write eof
buffer = TOTAL_EOF.write(buffer, c, true);
ConcurrentMap<Long, Long> networkBufferPool = DbleServer.getInstance().getBufferPool().getNetDirectMemoryUsage();
RowDataPacket row = new RowDataPacket(TOTAL_FIELD_COUNT);
long usedForNetwork = 0;
/* the value of -XX:MaxDirectMemorySize */
long totalAvailable = Platform.getMaxDirectMemory();
row.add(StringUtil.encode(JavaUtils.bytesToString2(totalAvailable), c.getCharset().getResults()));
/* IO packet used in DirectMemory in buffer pool */
for (Map.Entry<Long, Long> entry : networkBufferPool.entrySet()) {
usedForNetwork += entry.getValue();
}
row.add(StringUtil.encode(JavaUtils.bytesToString2(usedForNetwork), c.getCharset().getResults()));
row.add(StringUtil.encode(JavaUtils.bytesToString2(totalAvailable - usedForNetwork), c.getCharset().getResults()));
// write rows
byte packetId = TOTAL_EOF.getPacketId();
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.mysql.FieldPacket in project dble by actiontech.
the class ShowHeartbeat method response.
public static void response(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 (RowDataPacket row : getRows()) {
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);
// post write
c.write(buffer);
}
Aggregations