for (Addon addon : addonRegistry.getAddons())
{
if (AddonStatus.STARTED.equals(addon.getStatus()))
{
ServiceRegistry serviceRegistry = addon.getServiceRegistry();
if (type != null)
instanceCache.addAll(serviceRegistry.getExportedInstances(type));
else
instanceCache.addAll((Collection) serviceRegistry.getExportedInstances(typeName));
}
}
}
return instanceCache;