in jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Registry.java [90:121]
public OSGi<T> registerService(T service, Map<String, ?> properties) {
return (bc, p) -> {
synchronized (Registry.this) {
final ServiceWithProperties<T> serviceWithProperties =
new ServiceWithProperties<>(service, properties);
_servicesWithPropertiesList.add(serviceWithProperties);
OSGiResult result = p.publish(service);
for (FilteredPublisher<T> publisher :
new HashSet<>(_publishers)) {
publisher.publishIfMatched(service, properties);
}
return () -> {
synchronized (Registry.this) {
for (FilteredPublisher<T> publisher :
new HashSet<>(_publishers)) {
publisher.retract(service);
}
result.close();
_servicesWithPropertiesList.remove(
serviceWithProperties);
}
};
}
};
}