use of org.apache.geode.admin.RegionSubRegionSnapshot in project geode by apache.
the class RegionSubRegionsSizeResponse method populateSnapshot.
void populateSnapshot(DistributionManager dm) {
if (this.cancelled) {
return;
}
DistributedSystem sys = dm.getSystem();
InternalCache cache = (InternalCache) CacheFactory.getInstance(sys);
if (this.cancelled) {
return;
}
RegionSubRegionSnapshot root = new RegionSubRegionSnapshot();
/*
* This root exists only on admin side as a root of all root-region just to create a tree-like
* structure
*/
root.setName("Root");
root.setParent(null);
root.setEntryCount(0);
Set rootRegions = cache.rootRegions();
this.snapshot = root;
populateRegionSubRegions(root, rootRegions, cache);
}
use of org.apache.geode.admin.RegionSubRegionSnapshot in project geode by apache.
the class RegionSubRegionsSizeResponse method populateRegionSubRegions.
/**
* Populates the collection of sub-region snapshots for the parentSnapShot with snapshots for the
* regions given.
*
* @param parentSnapShot RegionSubRegionSnapshot of a parent region
* @param regions collection of sub-regions of the region represented by parentSnapShot
* @param cache cache instance is used for to get the LogWriter instance to log exceptions if any
*/
private void populateRegionSubRegions(RegionSubRegionSnapshot parentSnapShot, Set regions, InternalCache cache) {
if (this.cancelled) {
return;
}
for (Object region : regions) {
Region subRegion = (Region) region;
try {
RegionSubRegionSnapshot subRegionSnapShot = new RegionSubRegionSnapshot(subRegion);
parentSnapShot.addSubRegion(subRegionSnapShot);
Set subRegions = subRegion.subregions(false);
populateRegionSubRegions(subRegionSnapShot, subRegions, cache);
} catch (Exception e) {
logger.debug("Failed to create snapshot for region: {}. Continuing with next region.", subRegion.getFullPath(), e);
}
}
}
Aggregations