ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ClassLoaders loaders = new ClassLoaders();
loaders.put(classLoader);
loaders.put(this.getClass().getClassLoader());
DiscoverServiceNames dsn = new DiscoverServiceNames(loaders);
ResourceNameIterator iter = dsn.findResourceNames(LIFECYCLE_PROVIDER);
while (iter.hasNext())
{
String className = iter.nextResourceName();
Object obj = createClass(className,extContext);
if (DiscoverableLifecycleProvider.class.isAssignableFrom(obj.getClass()))
{
DiscoverableLifecycleProvider discoverableLifecycleProvider = (DiscoverableLifecycleProvider) obj;
if (discoverableLifecycleProvider.isAvailable())
{
LIFECYCLE_PROVIDER_INSTANCE = discoverableLifecycleProvider;
return (Boolean) true;
}
}
}
return (Boolean) false;
}
});
}
else
{
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ClassLoaders loaders = new ClassLoaders();
loaders.put(classLoader);
loaders.put(this.getClass().getClassLoader());
DiscoverServiceNames dsn = new DiscoverServiceNames(loaders);
ResourceNameIterator iter = dsn.findResourceNames(LIFECYCLE_PROVIDER);
while (iter.hasNext())
{
String className = iter.nextResourceName();
Object obj = createClass(className, externalContext);
if (DiscoverableLifecycleProvider.class.isAssignableFrom(obj.getClass()))
{
DiscoverableLifecycleProvider discoverableLifecycleProvider = (DiscoverableLifecycleProvider) obj;
if (discoverableLifecycleProvider.isAvailable())