final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<URLStreamHandlerService> serviceRef = new AtomicReference<URLStreamHandlerService>();
ServiceTracker<URLStreamHandlerService, URLStreamHandlerService> tracker = new ServiceTracker<URLStreamHandlerService, URLStreamHandlerService>(bundleContext, URLStreamHandlerService.class, null) {
@Override
public URLStreamHandlerService addingService(ServiceReference<URLStreamHandlerService> sref) {
URLStreamHandlerService service = super.addingService(sref);
if (srvfilter == null || srvfilter.match(sref)) {
serviceRef.set(bundleContext.getService(sref));
latch.countDown();
}
return service;