Skip to content

Commit

Permalink
FORGE-1699 - Performance enhancement - faster single instance lookup …
Browse files Browse the repository at this point in the history
…(uses existing cache)
  • Loading branch information
lincolnthree committed Apr 4, 2014
1 parent 02f75c6 commit 6188b65
Showing 1 changed file with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,10 @@ private ExportedInstance<T> getExportedInstance()
@Override
public ExportedInstance<T> call() throws Exception
{
ExportedInstance<T> result = null;

for (Addon addon : addonRegistry.getAddons())
{
if (AddonStatus.STARTED.equals(addon.getStatus()))
{
ServiceRegistry serviceRegistry = addon.getServiceRegistry();
if (type != null)
{
result = serviceRegistry.getExportedInstance(type);
}
else
{
result = serviceRegistry.getExportedInstance(typeName);
}
}
if (result != null)
break;
}

return result;
Iterator<ExportedInstance<T>> iterator = getExportedInstances().iterator();
if (iterator.hasNext())
return iterator.next();
return null;
}
});

Expand Down

0 comments on commit 6188b65

Please sign in to comment.