public final < T > ServiceRegistration < ? > registerService ( Class < T > iface , T instance , Dictionary < String , String > dictionary ) { logger . info ( "Register service '{}' for interface '{}' (context='" + context . getBundle ( ) . getSymbolicName ( ) + "')." , instance . getClass ( ) . getName ( ) , iface . getName ( ) ) ; ServiceRegistration < ? > serviceRegistration = context . registerService ( iface , instance , dictionary ) ; serviceRegistrations . add ( serviceRegistration ) ; return serviceRegistration ; }
This method should be used to register services . Services registered with this method auto de - registered during bundle stop .