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