//list contains only entries actually removed, and will not be null
final List<ServiceRegistryEntry> list = entryRegistryDelegate.evictModuleServices(moduleName);
//we have new list so can use it outside synchronised block
for (ServiceRegistryEntry serviceRegistryEntry : list) {
ServiceRemovedEvent event = new ServiceRemovedEvent(serviceRegistryEntry);
listenerRegistryDelegate.invokeListeners(event);
}
return list;
}