private static RowDataPacket getRow(NIOProcessor processor, String charset) { RowDataPacket row = new RowDataPacket(FIELD_COUNT); row.add(processor.getName().getBytes()); row.add(null); row.add(null); row.add(null); row.add(null); return row; }
public static void execute(ManagerConnection c) { ByteBuffer buffer = c.allocate(); // write header buffer = header.write(buffer, c); // write fields for (FieldPacket field : fields) { buffer = field.write(buffer, c); } // write eof buffer = eof.write(buffer, c); // write rows byte packetId = eof.packetId; RowDataPacket row = new RowDataPacket(FIELD_COUNT); row.packetId = ++packetId; row.add(LongUtil.toBytes(1)); buffer = row.write(buffer, c); // write last eof EOFPacket lastEof = new EOFPacket(); lastEof.packetId = ++packetId; buffer = lastEof.write(buffer, c); // post write c.write(buffer); }
public static void execute(ManagerConnection c) { ByteBuffer buffer = c.allocate(); // write header buffer = header.write(buffer, c); // write fields for (FieldPacket field : fields) { buffer = field.write(buffer, c); } // write eof buffer = eof.write(buffer, c); // write rows byte packetId = eof.packetId; Map<String, SchemaConfig> schemas = CobarServer.getInstance().getConfig().getSchemas(); for (String name : new TreeSet<String>(schemas.keySet())) { RowDataPacket row = new RowDataPacket(FIELD_COUNT); row.add(StringUtil.encode(name, c.getCharset())); row.packetId = ++packetId; buffer = row.write(buffer, c); } // write lastEof EOFPacket lastEof = new EOFPacket(); lastEof.packetId = ++packetId; buffer = lastEof.write(buffer, c); // write buffer c.write(buffer); }