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


Java ServerConnection.writeToBuffer方法代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:23,代碼來源:MultiNodeQueryHandler.java

示例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);
    }
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:23,代碼來源:SingleNodeHandler.java

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

示例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);
}
 
開發者ID:alibaba,項目名稱:cobar,代碼行數:15,代碼來源:SingleNodeHandler.java


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