@Override
    public void accept(final File file) {
        val fileName = file.getName();
        if (!(!fileName.isEmpty() && fileName.charAt(0) == '.') && Arrays.stream(serviceRegistryDao.getExtensions()).anyMatch(fileName::endsWith)) {
            LOGGER.debug("Service definition [{}] was deleted. Reloading cache...", file);
            val service = serviceRegistryDao.getRegisteredServiceFromFile(file);
            val clientInfo = ClientInfoHolder.getClientInfo();
            if (service != null) {
                serviceRegistryDao.publishEvent(new CasRegisteredServicePreDeleteEvent(this, service, clientInfo));
                serviceRegistryDao.removeRegisteredService(service);
                LOGGER.debug("Successfully deleted service definition [{}]", service.getName());
                serviceRegistryDao.publishEvent(new CasRegisteredServiceDeletedEvent(this, service, clientInfo));
            } else {
                LOGGER.warn("Unable to locate a matching service definition from file [{}]. Reloading cache...", file);
                val results = serviceRegistryDao.load();
                serviceRegistryDao.publishEvent(new CasRegisteredServicesLoadedEvent(this, results, clientInfo));
            }
        }
    }
This is {@link DeleteResourceBasedRegisteredServiceWatcher}.

@author Misagh Moayyed
@since 5.2.0
core/cas-server-core-services-registry/src/main/java/org/apereo/cas/services/resource/DeleteResourceBasedRegisteredServiceWatcher.java