当前位置: 首页>>代码示例>>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;未经允许,请勿转载。