use of com.actiontech.dble.net.mysql.HeartbeatPacket in project dble by actiontech.
the class Heartbeat method response.
public static void response(ServerConnection c, byte[] data) {
HeartbeatPacket hp = new HeartbeatPacket();
hp.read(data);
if (DbleServer.getInstance().isOnline()) {
OkPacket ok = new OkPacket();
ok.setPacketId(1);
ok.setAffectedRows(hp.getId());
ok.setServerStatus(2);
ok.write(c);
if (HEARTBEAT.isInfoEnabled()) {
HEARTBEAT.info(responseMessage("OK", c, hp.getId()));
}
} else {
ErrorPacket error = new ErrorPacket();
error.setPacketId(1);
error.setErrNo(ErrorCode.ER_SERVER_SHUTDOWN);
error.setMessage(String.valueOf(hp.getId()).getBytes());
error.write(c);
if (HEARTBEAT.isInfoEnabled()) {
HEARTBEAT.info(responseMessage("ERROR", c, hp.getId()));
}
}
}
Aggregations