use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class SingleNodeHandler method connectionError.
@Override
public void connectionError(Throwable e, MySQLConnection conn) {
if (!session.closeConnection(route)) {
conn.close();
}
endRunning();
ErrorPacket err = new ErrorPacket();
err.packetId = ++packetId;
err.errno = ErrorCode.ER_YES;
err.message = StringUtil.encode(e.getMessage(), session.getSource().getCharset());
ServerConnection source = session.getSource();
source.write(err.write(buffer, source));
}
use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class MultiNodeHandler method backendConnError.
protected void backendConnError(MySQLConnection conn, String errMsg) {
ErrorPacket err = new ErrorPacket();
// ERROR_PACKET
err.packetId = 1;
err.errno = ErrorCode.ER_YES;
err.message = StringUtil.encode(errMsg, session.getSource().getCharset());
backendConnError(conn, err);
}
use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class SingleNodeExecutor method handleError.
/**
* 执行异常处理
*/
private void handleError(int errno, String message, BlockingSession ss) {
endRunning();
// 清理
ss.clear();
ServerConnection sc = ss.getSource();
sc.setTxInterrupt();
// 通知
ErrorPacket err = new ErrorPacket();
// ERROR_PACKET
err.packetId = ++packetId;
err.errno = errno;
err.message = StringUtil.encode(message, sc.getCharset());
err.write(sc);
}
use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class KillConnectionHandler method errorResponse.
@Override
public void errorResponse(byte[] data, MySQLConnection conn) {
ErrorPacket err = new ErrorPacket();
err.read(data);
String msg = null;
try {
msg = new String(err.message, conn.getCharset());
} catch (UnsupportedEncodingException e) {
msg = new String(err.message);
}
LOGGER.warn("kill backend connection " + killee + " failed: " + msg);
conn.release();
killee.close();
finished();
}
use of com.alibaba.cobar.net.mysql.ErrorPacket in project cobar by alibaba.
the class RollbackNodeHandler method errorResponse.
@Override
public void errorResponse(byte[] data, MySQLConnection conn) {
ErrorPacket err = new ErrorPacket();
err.read(data);
backendConnError(conn, err);
}
Aggregations