use of com.actiontech.dble.net.mysql.OkPacket in project dble by actiontech.
the class UnLockTablesHandler method okResponse.
@Override
public void okResponse(byte[] data, BackendConnection conn) {
boolean executeResponse = conn.syncAndExecute();
if (executeResponse) {
boolean isEndPack = decrementCountBy(1);
session.releaseConnection(conn);
if (isEndPack) {
if (this.isFail() || session.closed()) {
tryErrorFinished(true);
return;
}
OkPacket ok = new OkPacket();
ok.read(data);
lock.lock();
try {
ok.setPacketId(++packetId);
ok.setServerStatus(session.getSource().isAutocommit() ? 2 : 1);
} finally {
lock.unlock();
}
ok.write(session.getSource());
}
}
}
use of com.actiontech.dble.net.mysql.OkPacket in project dble by actiontech.
the class LockTablesHandler method okResponse.
@Override
public void okResponse(byte[] data, BackendConnection conn) {
boolean executeResponse = conn.syncAndExecute();
if (executeResponse) {
if (clearIfSessionClosed(session)) {
return;
}
boolean isEndPack = decrementCountBy(1);
if (isEndPack) {
if (this.isFail() || session.closed()) {
tryErrorFinished(true);
return;
}
OkPacket ok = new OkPacket();
ok.read(data);
lock.lock();
try {
ok.setPacketId(++packetId);
ok.setServerStatus(session.getSource().isAutocommit() ? 2 : 1);
} finally {
lock.unlock();
}
ok.write(session.getSource());
}
}
}
use of com.actiontech.dble.net.mysql.OkPacket in project dble by actiontech.
the class KillConnection method response.
public static void response(String stmt, int offset, ManagerConnection mc) {
int count = 0;
List<FrontendConnection> list = getList(stmt, offset, mc);
if (list != null) {
for (FrontendConnection c : list) {
StringBuilder s = new StringBuilder();
LOGGER.info(s.append(c).append("killed by manager").toString());
c.killAndClose("kill by manager");
count++;
}
}
OkPacket packet = new OkPacket();
packet.setPacketId(1);
packet.setAffectedRows(count);
packet.setServerStatus(2);
packet.write(mc);
}
use of com.actiontech.dble.net.mysql.OkPacket in project dble by actiontech.
the class ReloadConfig method writeOKResult.
private static void writeOKResult(ManagerConnection c) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("send ok package to client " + String.valueOf(c));
}
OkPacket ok = new OkPacket();
ok.setPacketId(1);
ok.setAffectedRows(1);
ok.setServerStatus(2);
ok.setMessage("Reload config success".getBytes());
ok.write(c);
}
use of com.actiontech.dble.net.mysql.OkPacket in project dble by actiontech.
the class ReloadMetaData method execute.
public static void execute(ManagerConnection c) {
String msg = "data host has no write_host";
if (!DbleServer.getInstance().getConfig().isDataHostWithoutWR()) {
DbleServer.getInstance().setMetaChanging(true);
DbleServer.getInstance().reloadMetaData(DbleServer.getInstance().getConfig());
DbleServer.getInstance().setMetaChanging(false);
msg = "reload metadata success";
}
LOGGER.info(msg);
OkPacket ok = new OkPacket();
ok.setPacketId(1);
ok.setAffectedRows(1);
ok.setServerStatus(2);
ok.setMessage(msg.getBytes());
ok.write(c);
}
Aggregations