public Object getService(Filter filter, long timeout) throws OsgiServiceNotAvailableException {
ServiceTracker t = new ServiceTracker(bundleContext, filter, null);
LOGGER.debug("getting service for filter {} from tracker", filter);
Object result = waitForServiceFromTracker(t, timeout);
if (result == null) {
throw new OsgiServiceNotAvailableException(String.format(
"no service matching filter \"%s\" available at the time", filter.toString()));
}
return result;
}