try
{
Class<?> furnaceType = loader.loadClass("org.jboss.forge.furnace.impl.FurnaceImpl");
final Object instance = furnaceType.newInstance();
final Furnace furnace = (Furnace) ClassLoaderAdapterBuilder
.callingLoader(FurnaceFactory.class.getClassLoader())
.delegateLoader(loader).enhance(instance, Furnace.class);
Callable<Set<ClassLoader>> whitelistCallback = new Callable<Set<ClassLoader>>()
{
volatile long lastRegistryVersion = -1;
final Set<ClassLoader> result = Sets.getConcurrentSet();
@Override
public Set<ClassLoader> call() throws Exception
{
if (furnace.getStatus().isStarted())
{
long registryVersion = furnace.getAddonRegistry().getVersion();
if (registryVersion != lastRegistryVersion)
{
result.clear();
lastRegistryVersion = registryVersion;
for (Addon addon : furnace.getAddonRegistry().getAddons())
{
ClassLoader classLoader = addon.getClassLoader();
if (classLoader != null)
result.add(classLoader);
}