Search in sources :

Example 1 with HeartbeatException

use of com.alibaba.cobar.exception.HeartbeatException in project cobar by alibaba.

the class CobarDetectorHandler method handleErrorPacket.

/**
     * ERROR数据包处理
     */
private void handleErrorPacket(byte[] data) {
    ErrorPacket err = new ErrorPacket();
    err.read(data);
    switch(err.errno) {
        case ErrorCode.ER_SERVER_SHUTDOWN:
            source.getHeartbeat().setResult(CobarHeartbeat.OFF_STATUS, source, false, err.message);
            break;
        default:
            throw new HeartbeatException(new String(err.message));
    }
}
Also used : ErrorPacket(com.alibaba.cobar.net.mysql.ErrorPacket) HeartbeatException(com.alibaba.cobar.exception.HeartbeatException)

Example 2 with HeartbeatException

use of com.alibaba.cobar.exception.HeartbeatException in project cobar by alibaba.

the class MySQLDetectorHandler method handleErrorPacket.

/**
     * ERROR数据包处理
     */
private void handleErrorPacket(byte[] data) {
    ErrorPacket err = new ErrorPacket();
    err.read(data);
    throw new HeartbeatException(new String(err.message));
}
Also used : ErrorPacket(com.alibaba.cobar.net.mysql.ErrorPacket) HeartbeatException(com.alibaba.cobar.exception.HeartbeatException)

Aggregations

HeartbeatException (com.alibaba.cobar.exception.HeartbeatException)2 ErrorPacket (com.alibaba.cobar.net.mysql.ErrorPacket)2