static boolean isRegistered(ObjectName objectName){
  Set<ObjectName> registeredObjectNames=mBeanServer.queryNames(objectName,null);
  return !registeredObjectNames.isEmpty();
}

static boolean isRegistered ( ObjectName objectName ) { Set < ObjectName > registeredObjectNames = mBeanServer . queryNames ( objectName , null ) ; return ! registeredObjectNames . isEmpty ( ) ; }
checks whether an objectname is already registered .
