use of com.actiontech.dble.backend.datasource.PhysicalDBPool in project dble by actiontech.
the class StopHeartbeat method execute.
public static void execute(String stmt, ManagerConnection c) {
int count = 0;
Pair<String[], Integer> keys = ManagerParseStop.getPair(stmt);
if (keys.getKey() != null && keys.getValue() != null) {
long time = keys.getValue() * 1000L;
Map<String, PhysicalDBPool> dns = DbleServer.getInstance().getConfig().getDataHosts();
for (String key : keys.getKey()) {
PhysicalDBPool dn = dns.get(key);
if (dn != null) {
dn.getSource().setHeartbeatRecoveryTime(TimeUtil.currentTimeMillis() + time);
++count;
StringBuilder s = new StringBuilder();
s.append(dn.getHostName()).append(" stop heartbeat '");
LOGGER.info(s.append(FormatUtil.formatTime(time, 3)).append("' by manager.").toString());
}
}
}
OkPacket packet = new OkPacket();
packet.setPacketId(1);
packet.setAffectedRows(count);
packet.setServerStatus(2);
packet.write(c);
}
Aggregations