Example #1
0
 /**
  * @return the info of all active block workers
  * @throws IOException when work info list cannot be obtained from master
  * @throws AlluxioException if network connection failed
  */
 public List<BlockWorkerInfo> getWorkerInfoList() throws IOException, AlluxioException {
   List<BlockWorkerInfo> infoList = Lists.newArrayList();
   try (CloseableResource<BlockMasterClient> masterClientResource =
       mContext.acquireMasterClientResource()) {
     for (WorkerInfo workerInfo : masterClientResource.get().getWorkerInfoList()) {
       infoList.add(
           new BlockWorkerInfo(
               workerInfo.getAddress(), workerInfo.getCapacityBytes(), workerInfo.getUsedBytes()));
     }
     return infoList;
   }
 }