class StaticServicesRegistrationService {

    public synchronized StaticRegistrationResult reloadServices() {
        List<InstanceInfo> oldStaticInstances = new ArrayList<>(staticInstances);

        staticInstances.clear();
        StaticRegistrationResult result = registerServices(staticApiDefinitionsDirectories);

        PeerAwareInstanceRegistry registry = getRegistry();
        for (InstanceInfo info: oldStaticInstances) {
            if (!result.getRegisteredServices().contains(info.getInstanceId())) {
                log.info("Instance {} is not defined in the new static API definitions. It will be removed", info.getInstanceId());
                registry.cancel(info.getAppName(), info.getId(), false);
            }
        }

        return result;
    }

    @Autowired public  StaticServicesRegistrationService(ServiceDefinitionProcessor serviceDefinitionProcessor, MetadataDefaultsService metadataDefaultsService);

}