public static synchronized Class < ? > locate ( final String serviceName ) { if ( serviceName == null ) { throw new IllegalArgumentException ( "serviceName cannot be null" ) ; } if ( factories != null ) { List < Callable < Class < ? > > > l = factories . get ( serviceName ) ; if ( l != null && ! l . isEmpty ( ) ) { Callable < Class < ? > > c = l . get ( l . size ( ) - 1 ) ; try { return c . call ( ) ; } catch ( Exception e ) { } } } return null ; }
Finds the preferred provider for the given service . The preferred provider is the last one added to the set of providers .