public void executeBatchNodeCmd(SQLCtrlCommand cmdHandler) { this.cmdHandler = cmdHandler; final int initCount = session.getTargetCount(); runningCount.set(initCount); nodeCount = initCount; failed.set(false); faileCount.set(0); // 执行 int started = 0; for (RouteResultsetNode rrn : session.getTargetKeys()) { if (rrn == null) { LOGGER.error("null is contained in RoutResultsetNodes, source = " + session.getSource()); continue; } final BackendConnection conn = session.getTarget(rrn); if (conn != null) { conn.setResponseHandler(this); cmdHandler.sendCommand(session, conn); ++started; } } if (started < nodeCount) { runningCount.set(started); LOGGER.warn("some connection failed to execut " + (nodeCount - started)); /** * assumption: only caused by front-end connection close. <br> * Otherwise, packet must be returned to front-end */ failed.set(true); } }