public static Collection<Region<?,?>> listRootRegions(String regionPattern, JMX jmx)
	{
		//Use JMX to query for distributed regions
		//Ex: name GemFire:service=Region,name=/exampleRegion,type=Distributed
	
		
		String regionJmxPattern = String.format("GemFire:service=Region,name=/%s,type=Distributed",regionPattern);
		//this.getLogger().info("Searching for JMX region patterns: "+regionJmxPattern);
		
		Set<ObjectName> regionObjNameSet = jmx.searchObjectNames(regionJmxPattern);
		
		if(regionObjNameSet == null || regionObjNameSet.isEmpty())
		{
			//search with quotes
			regionJmxPattern = String.format("GemFire:service=Region,name=\"/%s\",type=Distributed",regionPattern);
			regionObjNameSet = jmx.searchObjectNames(regionJmxPattern);
		}
		
	
		if(regionObjNameSet == null || regionObjNameSet.isEmpty())
		{
			//this.getLogger().warn("No regions found");
			return null;
		}
		
		
		//sort the list
		regionObjNameSet = new TreeSet<ObjectName>(regionObjNameSet);
		
		ArrayList<Region<?,?>> regionSet = new ArrayList<Region<?,?>>(regionObjNameSet.size());

		String regionName = null;
		try
		{
			for (ObjectName regionObjectName : regionObjNameSet)
			{
				regionName = jmx.getAttribute(regionObjectName, "Name");
				
				
				if(regionName.startsWith("__")) {
					continue; //skip special regions
				}
				
				regionSet.add(getRegion(regionName,jmx));
				
			}
			
			
			
			return regionSet;
		}
		catch (InstanceNotFoundException e)
		{
			throw new RuntimeException("Cannot list regions:"+regionPattern+" ERROR:"+e.getMessage(),e);
		}
	}
public static Collection < Region < ? , ? > > listRootRegions ( String regionPattern , JMX jmx ) { String regionJmxPattern = String . format ( "GemFire:service=Region,name=/%s,type=Distributed" , regionPattern ) ; Set < ObjectName > regionObjNameSet = jmx . searchObjectNames ( regionJmxPattern ) ; if ( regionObjNameSet == null || regionObjNameSet . isEmpty ( ) ) { regionJmxPattern = String . format ( "GemFire:service=Region,name=\"/%s\",type=Distributed" , regionPattern ) ; regionObjNameSet = jmx . searchObjectNames ( regionJmxPattern ) ; } if ( regionObjNameSet == null || regionObjNameSet . isEmpty ( ) ) { return null ; } regionObjNameSet = new TreeSet < ObjectName > ( regionObjNameSet ) ; ArrayList < Region < ? , ? > > regionSet = new ArrayList < Region < ? , ? > > ( regionObjNameSet . size ( ) ) ; String regionName = null ; try { for ( ObjectName regionObjectName : regionObjNameSet ) { regionName = jmx . getAttribute ( regionObjectName , "Name" ) ; if ( regionName . startsWith ( "__" ) ) { continue ; } regionSet . add ( getRegion ( regionName , jmx ) ) ; } return regionSet ; } catch ( InstanceNotFoundException e ) { throw new RuntimeException ( "Cannot list regions:" + regionPattern + " ERROR:" + e . getMessage ( ) , e ) ; } }
<pre>
List all regions that match a wildcard expression (ex: R*).
Note that special internal regions that begin with the name __ will be skipped.
</pre>
@param regionPattern the region pattern
@param jmx the JMX manager connection
@return the collection of region