コード例 #1
0
 protected void kill() {
   boolean hooked = false;
   AtomicInteger count = null;
   Map<RouteResultsetNode, BackendConnection> killees = null;
   for (RouteResultsetNode node : target.keySet()) {
     BackendConnection c = target.get(node);
     if (c != null) {
       if (!hooked) {
         hooked = true;
         killees = new HashMap<RouteResultsetNode, BackendConnection>();
         count = new AtomicInteger(0);
       }
       killees.put(node, c);
       count.incrementAndGet();
     }
   }
   if (hooked) {
     ConnectionMeta conMeta = new ConnectionMeta(null, null, -1, true);
     for (Entry<RouteResultsetNode, BackendConnection> en : killees.entrySet()) {
       KillConnectionHandler kill = new KillConnectionHandler(en.getValue(), this);
       MycatConfig conf = MycatSystem.getInstance().getConfig();
       PhysicalDBNode dn = conf.getDataNodes().get(en.getKey().getName());
       try {
         dn.getConnectionFromSameSource(conMeta, en.getValue(), kill, en.getKey());
       } catch (Exception e) {
         LOGGER.error("get killer connection failed for " + en.getKey(), e);
         kill.connectionError(e, null);
       }
     }
   }
 }
コード例 #2
0
ファイル: ClearSlow.java プロジェクト: tt5753/openclouddb
 public static void dataNode(ManagerConnection c, String name) {
   PhysicalDBNode dn = MycatServer.getInstance().getConfig().getDataNodes().get(name);
   PhysicalDBPool ds = null;
   if (dn != null && ((ds = dn.getDbPool()) != null)) {
     // ds.getSqlRecorder().clear();
     c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
   } else {
     c.writeErrMessage(ErrorCode.ER_YES, "Invalid DataNode:" + name);
   }
 }