本文整理汇总了Java中org.opencloudb.net.mysql.RowDataPacket类的典型用法代码示例。如果您正苦于以下问题:Java RowDataPacket类的具体用法?Java RowDataPacket怎么用?Java RowDataPacket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RowDataPacket类属于org.opencloudb.net.mysql包,在下文中一共展示了RowDataPacket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
private static RowDataPacket getRow(NIOProcessor processor, String charset) {
BufferPool bufferPool=processor.getBufferPool();
int bufferSize=bufferPool.size();
int bufferCapacity=bufferPool.capacity();
int bufferTempLocatedTimes=bufferPool.getNewCount();
int bufferUsagePercent=(bufferCapacity-bufferSize)*100/bufferCapacity;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(processor.getName().getBytes());
row.add(LongUtil.toBytes(processor.getNetInBytes()));
row.add(LongUtil.toBytes(processor.getNetOutBytes()));
row.add(LongUtil.toBytes(0));
row.add(IntegerUtil.toBytes(0));
row.add(IntegerUtil.toBytes(processor.getWriteQueueSize()));
row.add(IntegerUtil.toBytes(bufferSize));
row.add(IntegerUtil.toBytes(bufferCapacity));
row.add(IntegerUtil.toBytes(bufferUsagePercent));
row.add(IntegerUtil.toBytes(bufferTempLocatedTimes));
row.add(IntegerUtil.toBytes(processor.getFrontends().size()));
row.add(IntegerUtil.toBytes(processor.getBackends().size()));
return row;
}
示例2: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
buffer = header.write(buffer, c);
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
buffer = eof.write(buffer, c);
byte packetId = eof.packetId;
String charset = c.getCharset();
for (NIOProcessor p : MycatServer.getInstance().getProcessors()) {
for (BackendConnection bc : p.getBackends().values()) {
if (bc != null) {
RowDataPacket row = getRow(bc, charset);
row.packetId = ++packetId;
buffer = row.write(buffer, c);
}
}
}
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
c.write(buffer);
}
示例3: response
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
public static void response(ServerConnection c) {
ByteBuffer buffer = c.allocate();
buffer = header.write(buffer, c);
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
buffer = eof.write(buffer, c);
byte packetId = eof.packetId;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(1));
row.packetId = ++packetId;
buffer = row.write(buffer, c);
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
c.write(buffer);
}
示例4: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
buffer = header.write(buffer, c,true);
for (FieldPacket field : fields) {
buffer = field.write(buffer, c,true);
}
buffer = eof.write(buffer, c,true);
byte packetId = eof.packetId;
String charset = c.getCharset();
for (NIOProcessor p : MycatServer.getInstance().getProcessors()) {
for (BackendConnection bc : p.getBackends().values()) {
if (bc != null) {
RowDataPacket row = getRow(bc, charset);
row.packetId = ++packetId;
buffer = row.write(buffer, c,true);
}
}
}
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c,true);
c.write(buffer);
}
示例5: response
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
public static void response(ServerConnection c) {
ByteBuffer buffer = c.allocate();
buffer = header.write(buffer, c,true);
for (FieldPacket field : fields) {
buffer = field.write(buffer, c,true);
}
buffer = eof.write(buffer, c,true);
byte packetId = eof.packetId;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(Versions.SERVER_VERSION);
row.packetId = ++packetId;
buffer = row.write(buffer, c,true);
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c,true);
c.write(buffer);
}
示例6: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
private static RowDataPacket getRow(String charset) {
MycatServer server = MycatServer.getInstance();
long startupTime = server.getStartupTime();
long now = TimeUtil.currentTimeMillis();
long uptime = now - startupTime;
Runtime rt = Runtime.getRuntime();
long total = rt.totalMemory();
long max = rt.maxMemory();
long used = (total - rt.freeMemory());
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(FormatUtil.formatTime(uptime, 3), charset));
row.add(LongUtil.toBytes(used));
row.add(LongUtil.toBytes(total));
row.add(LongUtil.toBytes(max));
row.add(LongUtil.toBytes(server.getConfig().getReloadTime()));
row.add(LongUtil.toBytes(server.getConfig().getRollbackTime()));
row.add(StringUtil.encode(charset, charset));
row.add(StringUtil.encode(MycatServer.getInstance().isOnline() ? "ON" : "OFF", charset));
return row;
}
示例7: response
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
public static void response(ServerConnection c) {
ByteBuffer buffer = c.allocate();
buffer = header.write(buffer, c,true);
for (FieldPacket field : fields) {
buffer = field.write(buffer, c,true);
}
buffer = eof.write(buffer, c,true);
byte packetId = eof.packetId;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(1));
row.packetId = ++packetId;
buffer = row.write(buffer, c,true);
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c,true);
c.write(buffer);
}
示例8: aggregateRow
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
private void aggregateRow(RowDataPacket toRow, RowDataPacket newRow) {
if (mergCols == null) {
return;
}
for (MergeCol merg : mergCols) {
byte[] result = mertFields(
toRow.fieldValues.get(merg.colMeta.colIndex),
newRow.fieldValues.get(merg.colMeta.colIndex),
merg.colMeta.colType, merg.mergeType);
if (result != null) {
toRow.fieldValues.set(merg.colMeta.colIndex, result);
}
}
}
示例9: getResults
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
/**
* return merged data
*
* @return
*/
public Collection<RowDataPacket> getResults() {
Collection<RowDataPacket> tmpResult = result;
if (this.grouper != null) {
tmpResult = grouper.getResult();
grouper = null;
}
if (sorter != null) {
Iterator<RowDataPacket> itor = tmpResult.iterator();
while (itor.hasNext()) {
sorter.addRow(itor.next());
itor.remove();
}
tmpResult = sorter.getSortedResult();
sorter = null;
}
return tmpResult;
}
示例10: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
private static RowDataPacket getRow(FrontendConnection c, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(c.getProcessor().getName().getBytes());
row.add(LongUtil.toBytes(c.getId()));
row.add(StringUtil.encode(c.getHost(), charset));
row.add(IntegerUtil.toBytes(c.getPort()));
row.add(IntegerUtil.toBytes(c.getLocalPort()));
row.add(StringUtil.encode(c.getSchema(), charset));
row.add(StringUtil.encode(c.getCharset(), charset));
row.add(LongUtil.toBytes(c.getNetInBytes()));
row.add(LongUtil.toBytes(c.getNetOutBytes()));
row.add(LongUtil.toBytes((TimeUtil.currentTimeMillis() - c.getStartupTime()) / 1000L));
row.add(IntegerUtil.toBytes(c.getWriteAttempts()));
ByteBuffer bb = c.getReadBuffer();
row.add(IntegerUtil.toBytes(bb == null ? 0 : bb.capacity()));
BufferQueue bq = c.getWriteQueue();
row.add(IntegerUtil.toBytes(bq == null ? 0 : bq.size()));
if (c instanceof ServerConnection) {
ServerConnection sc = (ServerConnection) c;
row.add(IntegerUtil.toBytes(sc.getSession2().getTargetCount()));
} else {
row.add(null);
}
return row;
}
示例11: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
private static RowDataPacket getRow(FrontendConnection c, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(c.getId()));
row.add(StringUtil.encode(c.getHost(), charset));
row.add(StringUtil.encode(c.getSchema(), charset));
row.add(LongUtil.toBytes(c.getLastReadTime()));
long rt = c.getLastReadTime();
long wt = c.getLastWriteTime();
row.add(LongUtil.toBytes((wt > rt) ? (wt - rt) : (TimeUtil.currentTimeMillis() - rt)));
row.add(null);
return row;
}
示例12: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
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;
for (Map.Entry<String, String> e : variables.entrySet()) {
RowDataPacket row = getRow(e.getKey(), e.getValue(), 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);
}
示例13: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
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.packetId;
for (NIOProcessor p : MycatServer.getInstance().getProcessors()) {
RowDataPacket row = getRow(p, c.getCharset());
row.packetId = ++packetId;
buffer = row.write(buffer, c,true);
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c,true);
// write buffer
c.write(buffer);
}
示例14: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
private static RowDataPacket getRow(NIOProcessor processor, String charset) {
CommandCount cc = processor.getCommands();
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(processor.getName().getBytes());
row.add(LongUtil.toBytes(cc.initDBCount()));
row.add(LongUtil.toBytes(cc.queryCount()));
row.add(LongUtil.toBytes(cc.stmtPrepareCount()));
row.add(LongUtil.toBytes(cc.stmtExecuteCount()));
row.add(LongUtil.toBytes(cc.stmtCloseCount()));
row.add(LongUtil.toBytes(cc.pingCount()));
row.add(LongUtil.toBytes(cc.killCount()));
row.add(LongUtil.toBytes(cc.quitCount()));
row.add(LongUtil.toBytes(cc.otherCount()));
return row;
}
示例15: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入依赖的package包/类
public static void execute(ManagerConnection c, int type) {
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.packetId;
RowDataPacket row = getRow(type);
row.packetId = ++packetId;
buffer = row.write(buffer, c,true);
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c,true);
// post write
c.write(buffer);
}