private static boolean isExistingRegionOnServer ( String regionName , JMX jmx ) { String regionJmxPattern = String . format ( "GemFire:service=Region,name=/%s,type=Distributed" , regionName ) ; //System.out.println("searching for:"+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" , regionName ) ; //System.out.println("searching for:"+regionJmxPattern); regionObjNameSet = jmx . searchObjectNames ( regionJmxPattern ) ; } return regionObjNameSet != null && ! regionObjNameSet . isEmpty ( ) ; }
Determine if a given region exists