本文整理汇总了Java中com.alibaba.cobar.server.ServerConnection.writeToBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java ServerConnection.writeToBuffer方法的具体用法?Java ServerConnection.writeToBuffer怎么用?Java ServerConnection.writeToBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.cobar.server.ServerConnection
的用法示例。
在下文中一共展示了ServerConnection.writeToBuffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fieldEofResponse
import com.alibaba.cobar.server.ServerConnection; //导入方法依赖的package包/类
@Override
public void fieldEofResponse(byte[] header, List<byte[]> fields, byte[] eof, MySQLConnection conn) {
lock.lock();
try {
if (fieldsReturned) {
return;
}
fieldsReturned = true;
header[3] = ++packetId;
ServerConnection source = session.getSource();
buffer = source.writeToBuffer(header, buffer);
for (int i = 0, len = fields.size(); i < len; ++i) {
byte[] field = fields.get(i);
field[3] = ++packetId;
buffer = source.writeToBuffer(field, buffer);
}
eof[3] = ++packetId;
buffer = source.writeToBuffer(eof, buffer);
} finally {
lock.unlock();
}
}
示例2: okResponse
import com.alibaba.cobar.server.ServerConnection; //导入方法依赖的package包/类
@Override
public void okResponse(byte[] data, MySQLConnection conn) {
boolean executeResponse = false;
try {
executeResponse = conn.syncAndExcute();
} catch (UnsupportedEncodingException e) {
executeException(conn);
}
if (executeResponse) {
conn.setRunning(false);
ServerConnection source = session.getSource();
if (source.isAutocommit()) {
session.clearConnections();
}
endRunning();
OkPacket ok = new OkPacket();
ok.read(data);
source.setLastInsertId(ok.insertId);
buffer = source.writeToBuffer(data, buffer);
source.write(buffer);
}
}
示例3: rowEofResponse
import com.alibaba.cobar.server.ServerConnection; //导入方法依赖的package包/类
@Override
public void rowEofResponse(byte[] eof, MySQLConnection conn) {
ServerConnection source = session.getSource();
conn.setRunning(false);
conn.recordSql(source.getHost(), source.getSchema(), route.getStatement());
if (source.isAutocommit()) {
session.clearConnections();
}
endRunning();
buffer = source.writeToBuffer(eof, buffer);
source.write(buffer);
}
示例4: fieldEofResponse
import com.alibaba.cobar.server.ServerConnection; //导入方法依赖的package包/类
@Override
public void fieldEofResponse(byte[] header, List<byte[]> fields, byte[] eof, MySQLConnection conn) {
ServerConnection source = session.getSource();
buffer = session.getSource().allocate();
++packetId;
buffer = source.writeToBuffer(header, buffer);
for (int i = 0, len = fields.size(); i < len; ++i) {
++packetId;
buffer = source.writeToBuffer(fields.get(i), buffer);
}
++packetId;
buffer = source.writeToBuffer(eof, buffer);
source.write(buffer);
}