本文整理匯總了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);
}