code: @SuppressWarnings( "unchecked" )
      public static <T> T getService( BundleContext bc, String className, long timeout,
              Map<String, String> props )
      {
          ServiceTracker tracker = createServiceTracker( bc, className, props );
          try
          {
              tracker.open();
              Object svc = tracker.waitForService( timeout );
              if( svc == null )
              {
                  throw new ServiceLookupException( "gave up waiting for service " + className );
              }
              // increment the service use count to keep it valid after the ServiceTracker is closed
              return (T) bc.getService( tracker.getServiceReference() );
          }
          catch ( InterruptedException exc )
          {
              throw new ServiceLookupException( exc );
          }
          finally
          {
              tracker.close();
          }
      }
docs: Returns a service matching the given criteria.
  
  @param <T> class implemented or extended by the service
  @param bc bundle context for accessing the OSGi registry
  @param className name of class implemented or extended by the service
  @param timeout maximum wait period in milliseconds
  @param props properties to be matched by the service
  @return matching service (not null)
  @throws ServiceLookupException when no matching service has been found after the timeout