use of com.alibaba.cobar.mysql.nio.handler.MultiNodeQueryHandler in project cobar by alibaba.
the class NonBlockingSession method execute.
@Override
public void execute(RouteResultset rrs, int type) {
if (LOGGER.isDebugEnabled()) {
StringBuilder s = new StringBuilder();
LOGGER.debug(s.append(source).append(rrs).toString());
}
// 检查路由结果是否为空
RouteResultsetNode[] nodes = rrs.getNodes();
if (nodes == null || nodes.length == 0) {
source.writeErrMessage(ErrorCode.ER_NO_DB_ERROR, "No dataNode selected");
return;
}
if (nodes.length == 1) {
singleNodeHandler = new SingleNodeHandler(nodes[0], this);
// singleNodeHandler.execute();
} else {
boolean autocommit = source.isAutocommit();
if (autocommit && isModifySQL(type)) {
autocommit = false;
}
multiNodeHandler = new MultiNodeQueryHandler(nodes, autocommit, this);
// multiNodeHandler.execute();
}
}
Aggregations