Exemplo n.º 1
0
 @Override
 public ArrayList<HashMap> doExecute(Map<String, Object> args) {
   Cache cache = CacheFactory.getAnyInstance();
   String regionPath = (String) args.get(ApiConstant.REGIONPATH);
   Region region = cache.getRegion(regionPath);
   ArrayList<HashMap> list = new ArrayList<HashMap>();
   if (region != null && region instanceof PartitionedRegion) {
     DistributedMember member = cache.getDistributedSystem().getDistributedMember();
     PartitionedRegion pr = (PartitionedRegion) region;
     if (pr.getDataStore() != null) {
       Set<BucketRegion> set2 = pr.getDataStore().getAllLocalBucketRegions();
       for (BucketRegion br : set2) {
         HashMap map = new HashMap();
         map.put("BucketId", br.getId());
         map.put("Size", br.size());
         map.put("Bytes", br.getTotalBytes());
         map.put("host", getHost());
         map.put("node", System.getProperty("NODE_NAME"));
         InternalDistributedMember m = pr.getBucketPrimary(br.getId());
         if (m != null && member.getId().equals(m.getId())) {
           map.put("type", "primary");
         } else {
           map.put("type", "redundant");
         }
         map.put("TotalNumBuckets", pr.getPartitionAttributes().getTotalNumBuckets());
         list.add(map);
       }
     }
   }
   return list;
 }