Exemplo n.º 1
0
 @Override
 public RespDto findFileMdAttr(FileMdAttrPosList fileMdAttrPosList) {
   List<ClusterNodeInfo> clusterNodeInfos = fileMdAttrPosList.getClusterNodeInfos();
   RespDto respDto = new RespDto();
   String fileCode = fileMdAttrPosList.getFileCode();
   for (ClusterNodeInfo nodeInfo : clusterNodeInfos) {
     BackendClient client = new BackendClient(nodeInfo.getIp(), nodeInfo.getPort());
     client.connectAndHandle(new FindFileMdAttrHandler(fileCode, respDto));
     if (respDto.getSuccess()) {
       break;
     }
   }
   return respDto;
 }
Exemplo n.º 2
0
 @Override
 public List<MdAttr> findDirMdAttr(DirMdAttrPosList dirMdAttrPosList) {
   List<ClusterNodeInfo> clusterNodeInfos = dirMdAttrPosList.getClusterNodeInfos();
   RespDto respDto = new RespDto();
   List<MdAttr> mdAttrs = new ArrayList<MdAttr>();
   for (ClusterNodeInfo nodeInfo : clusterNodeInfos) {
     BackendClient client = new BackendClient(nodeInfo.getIp(), nodeInfo.getPort());
     client.connectAndHandle(new FindDirMdAttrHandler(nodeInfo.getDistrCode(), respDto));
     if (!respDto.getSuccess()) {
       logger.error(String.format("Get mdAttr from Node: %s err. resp is:%s", nodeInfo, respDto));
     }
     MdAttrListDto partMdAttrs = JSON.parseObject(respDto.getObjStr(), MdAttrListDto.class);
     for (MdAttr mdAttr : partMdAttrs.getMdAttrList()) {
       mdAttrs.add(mdAttr);
     }
   }
   return mdAttrs;
 }