Class ServiceLoaderImpl
java.lang.Object
org.glassfish.hk2.osgiresourcelocator.ServiceLoader
org.glassfish.hk2.osgiresourcelocator.ServiceLoaderImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate static classprivate static classList ofServiceLoaderImpl.ProvidersPerBundleSynchronisation is handled by outer class.private static classMap of service name to provider names for a particular bundleNested classes/interfaces inherited from class ServiceLoader
ServiceLoader.ProviderFactory<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.osgi.framework.BundleContextprivate org.osgi.framework.BundleListenerprivate ServiceLoaderImpl.ProvidersListprivate ReadWriteLock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddProviders(org.osgi.framework.Bundle bundle) private voidprivate voidprivate org.osgi.framework.BundleContextgetBundleContextSecured(org.osgi.framework.Bundle bundle) private booleanisCompatible(Class providerClass, Class serviceClass) load(InputStream is) Loads a single service file and returns the names of the providers.private ClassloadClassSecured(org.osgi.framework.Bundle bundle, String name) lookupProviderClasses1(Class<T> serviceClass) (package private) <T> Iterable<? extends T> lookupProviderInstances1(Class<T> serviceClass, ServiceLoader.ProviderFactory<T> factory) private voidremoveProviders(org.osgi.framework.Bundle bundle) voidMethods inherited from class ServiceLoader
initialize, lookupProviderClasses, lookupProviderInstances, lookupProviderInstances, reset
-
Field Details
-
rwLock
-
bundleTracker
private org.osgi.framework.BundleListener bundleTracker -
bundleContext
private org.osgi.framework.BundleContext bundleContext -
providersList
-
-
Constructor Details
-
ServiceLoaderImpl
public ServiceLoaderImpl()
-
-
Method Details
-
getBundleContextSecured
private org.osgi.framework.BundleContext getBundleContextSecured(org.osgi.framework.Bundle bundle) -
trackBundles
public void trackBundles() -
lookupProviderInstances1
<T> Iterable<? extends T> lookupProviderInstances1(Class<T> serviceClass, ServiceLoader.ProviderFactory<T> factory) - Specified by:
lookupProviderInstances1in classServiceLoader
-
lookupProviderClasses1
- Specified by:
lookupProviderClasses1in classServiceLoader
-
loadClassSecured
private Class loadClassSecured(org.osgi.framework.Bundle bundle, String name) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
isCompatible
-
load
Loads a single service file and returns the names of the providers. If the same provider appears multiple times, the list contains only one entry for all of the duplicates.- Returns:
- names of providers, empty list if none is found
- Throws:
IOException
-
addProviders
private void addProviders(org.osgi.framework.Bundle bundle) -
removeProviders
private void removeProviders(org.osgi.framework.Bundle bundle) -
debug
-
debug
-