Reputation: 51
I am looking for a way to programmatically retrieve all regions and return the count/size. I can see how gfsh has the "list regions" but can't seem to find the backing java api command. I've tried
cache = ClientCacheFactory().addPoolLocator().create();
RegionService regionService =
clientCache.createAuthenticatedView(properties);
but the resulting regionService.rootRegions is empty. I can get query service and run something like "select count(*) from /UserRegion" but would like to dynamically retrieve the regions.
Upvotes: 1
Views: 806
Reputation: 71
You can get the list of region by Gemfire management service through JMX client.
MemberMXBean mbeanProxy =
(MemberMXBean) MBeanServerInvocationHandler.newProxyInstance(
mbeanServerConnection, mbeanName, MemberMXBean.class, true);
String[] listRegions = mbeanProxy.listRegions();
for (int i = 0; i < listRegions.length; i++) {
System.out.println(listRegions[i]);
}
Upvotes: 0