當前位置: 首頁>>代碼示例>>Java>>正文


Java RowDataPacket類代碼示例

本文整理匯總了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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:22,代碼來源:ShowProcessor.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:24,代碼來源:ShowBackend.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:18,代碼來源:SessionIncrement.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:24,代碼來源:ShowBackend.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:18,代碼來源:SelectVersion.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:21,代碼來源:ShowServer.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:18,代碼來源:SessionIncrement.java

示例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);
		}
	}

}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:17,代碼來源:RowDataPacketGrouper.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:24,代碼來源:DataMergeService.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:26,代碼來源:ShowConnection.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:13,代碼來源:ShowConnectionSQL.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:31,代碼來源:ShowVariables.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:31,代碼來源:ShowCommand.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:16,代碼來源:ShowCommand.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:29,代碼來源:ShowTime.java


注:本文中的org.opencloudb.net.mysql.RowDataPacket類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。