/** * Scans the given category for plugins only if needed. After this method has been * invoked once for a given category, it will no longer scan for that category. */ private <T> void scanForPluginsIfNeeded(final Class<?> category) { if (needScanForPlugins != null && needScanForPlugins.remove(category)) { if (needScanForPlugins.isEmpty()) { needScanForPlugins = null; } scanForPlugins(getClassLoaders(), category); } }
/** * Scans for factory plug-ins on the application class path. This method is * needed because the application class path can theoretically change, or * additional plug-ins may become available. Rather than re-scanning the * classpath on every invocation of the API, the class path is scanned * automatically only on the first invocation. Clients can call this * method to prompt a re-scan. Thus this method need only be invoked by * sophisticated applications which dynamically make new plug-ins * available at runtime. */ public void scanForPlugins() { final Set<ClassLoader> loaders = getClassLoaders(); for (final Iterator<Class<?>> categories=getCategories(); categories.hasNext();) { final Class<?> category = categories.next(); scanForPlugins(loaders, category); } }
/** * Scans for factory plug-ins on the application class path. This method is * needed because the application class path can theoretically change, or * additional plug-ins may become available. Rather than re-scanning the * classpath on every invocation of the API, the class path is scanned * automatically only on the first invocation. Clients can call this * method to prompt a re-scan. Thus this method need only be invoked by * sophisticated applications which dynamically make new plug-ins * available at runtime. */ public void scanForPlugins() { final Set loaders = getClassLoaders(); for (final Iterator categories=getCategories(); categories.hasNext();) { final Class category = (Class) categories.next(); scanForPlugins(loaders, category); } }
scanForPlugins(getClassLoaders(), category); iterator = getServiceProviders(category, true);
Iterator iterator = getServiceProviders(category, hintsFilter, true); if (!iterator.hasNext()) { scanForPlugins(getClassLoaders(), category); iterator = getServiceProviders(category, hintsFilter, true);