//filter only export types
filterReferenceByExportTypes(values, types);
//check each entry against filter
for (Iterator<ServiceRegistryEntry> iterator = values.iterator(); iterator.hasNext();) {
ServiceRegistryEntry serviceReference = iterator.next();
if (!filter.matches(serviceReference)) {
iterator.remove();
}
}
return serviceReferenceSorter.sort(values, true);
} else {
//Create new list of services for concurrency protection
final List<ServiceRegistryEntry> values;
try {
registryReadLock.lock();
values = new LinkedList<ServiceRegistryEntry>(this.services);
} finally {
registryReadLock.unlock();
}
for (Iterator<ServiceRegistryEntry> iterator = values.iterator(); iterator.hasNext();) {
ServiceRegistryEntry serviceReference = iterator.next();
if (!(classChecker.matchesTypes(serviceReference, types) && filter.matches(serviceReference))) {
iterator.remove();
}
}