@Override
    public void synchronize(final RegisteredService service) {
        this.serviceRegistries
            .stream()
            .filter(serviceRegistry -> {
                if (StringUtils.isNotBlank(service.getServiceId())) {
                    val match = serviceRegistry.findServiceByExactServiceId(service.getServiceId());
                    if (match != null) {
                        LOGGER.debug("Skipping [{}] JSON service definition in [{}] as a matching service [{}] is found in the registry",
                            service.getName(), serviceRegistry.getName(), match.getName());
                        return false;
                    }
                }
                val match = serviceRegistry.findServiceById(service.getId());
                if (match != null) {
                    LOGGER.debug("Skipping [{}] JSON service definition in [{}] as a matching id [{}] is found in the registry",
                        service.getName(), serviceRegistry.getName(), match.getId());
                    return false;
                }
                return true;
            })
            .forEach(serviceRegistry -> serviceRegistry.save(service));
    }
This is {@link DefaultChainingServiceRegistry}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-services-registry/src/main/java/org/apereo/cas/services/DefaultChainingServiceRegistry.java