private < T > T getService ( final Class < T > serviceType , final long timeoutInMillis ) throws NoSuchServiceException { LOG . info ( "Look up service [" + serviceType . getName ( ) + "], timeout in " + timeoutInMillis + " millis" ) ; final ServiceReference ref = m_bundleContext . getServiceReference ( serviceType . getName ( ) ) ; if ( ref != null ) { final Object service = m_bundleContext . getService ( ref ) ; if ( service == null ) { throw new NoSuchServiceException ( serviceType ) ; } return ( T ) service ; } else { throw new NoSuchServiceException ( serviceType ) ; } }
Lookup a service in the service registry .