public static void execute(MySQLFrontConnection c) { final ReentrantLock lock = MycatServer.getInstance().getConfig().getLock(); lock.lock(); try { if (ReloadUtil.rollback()) { StringBuilder s = new StringBuilder(); s.append(c).append("Rollback config success by manager"); LOGGER.warn(s.toString()); OkPacket ok = new OkPacket(); ok.packetId = 1; ok.affectedRows = 1; ok.serverStatus = 2; ok.message = "Rollback config success".getBytes(); ok.write(c); } else { c.writeErrMessage(ErrorCode.ER_YES, "Rollback config failure"); } } finally { lock.unlock(); } }
public static void response(MySQLFrontConnection c, byte[] data) { HeartbeatPacket hp = new HeartbeatPacket(); hp.read(data); if (MycatServer.getInstance().isOnline()) { OkPacket ok = new OkPacket(); ok.packetId = 1; ok.affectedRows = hp.id; ok.serverStatus = 2; ok.write(c); if (HEARTBEAT.isInfoEnabled()) { HEARTBEAT.info(responseMessage("OK", c, hp.id)); } } else { ErrorPacket error = new ErrorPacket(); error.packetId = 1; error.errno = ErrorCode.ER_SERVER_SHUTDOWN; error.message = String.valueOf(hp.id).getBytes(); error.write(c); if (HEARTBEAT.isInfoEnabled()) { HEARTBEAT.info(responseMessage("ERROR", c, hp.id)); } } }