if (removedServices.containsKey(url)) {
removedServices.remove(url);
} else { // we don't know the service, so we need to create the
final ServicePropertiesAdapter spa = new ServicePropertiesAdapter((List) entry.getValue());
final String serviceName = spa.getServiceName() == null ? url.toString() : spa.getServiceName();
final IServiceInfo serviceInfo = new JSLPServiceInfo(serviceName, new ServiceURLAdapter(url), spa.getPriority(), spa.getWeight(), spa);
services.put(url, serviceInfo);
discoveryContainer.fireServiceTypeDiscovered(serviceInfo.getServiceID().getServiceTypeID());
discoveryContainer.fireServiceDiscovered(serviceInfo);
}
monitor.worked(1);
}
// at this point removedServices only contains stale services
for (final Iterator itr = removedServices.entrySet().iterator(); itr.hasNext() && !monitor.isCanceled();) {
final Map.Entry entry = (Map.Entry) itr.next();
final Object key = entry.getKey();
final IServiceInfo value = (IServiceInfo) entry.getValue();
discoveryContainer.fireServiceUndiscovered(value);
services.remove(key);
monitor.worked(1);
}