code: public String getUserRegistryRealm(AtomicServiceReference<SecurityService> securityServiceRef) {
          String realm = "defaultRealm";
          try {
              SecurityService securityService = securityServiceRef.getService();
              UserRegistryService userRegistryService = securityService.getUserRegistryService();
              if (userRegistryService.isUserRegistryConfigured()) {
                  realm = userRegistryService.getUserRegistry().getRealm();
              }
          } catch (RegistryException re) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "RegistryException while trying to get the realm", re);
              }
          }
          return realm;
      }
docs: Attempt to retrieve the registry realm for the configured registry.
  <p>
  It is possible that no registry is configured. If that is the case,
  return the default realm name.
  
  @return realm name. {@code null} is not returned.