private void scan ( List < File > files , List < T > factories ) { for ( File jar : files ) { try { URL extensionURL = jar . toURI ( ) . toURL ( ) ; String jarPath = extensionURL . toString ( ) ; ClassLoader extensionsClassLoader = new ExtensionsClassLoader ( new URL [ ] { extensionURL } , ClassLoader . getSystemClassLoader ( ) ) ; ServiceLoader < T > extensionServiceLoader = ServiceLoader . load ( mFactoryClass , extensionsClassLoader ) ; for ( T factory : extensionServiceLoader ) { LOG . debug ( "Discovered a factory implementation {} - {} in jar {}" , factory . getClass ( ) , factory , jarPath ) ; register ( factory , factories ) ; } } catch ( Throwable t ) { LOG . warn ( "Failed to load jar {}: {}" , jar , t . toString ( ) ) ; } } }
Class - loads jar files that have not been loaded .