Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/879#discussion_r149314895 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java --- @@ -536,8 +538,52 @@ public BrooklynObject lookup(String id) { result = getLocationManager().getLocation(id); if (result!=null && type.isInstance(result)) return (T)result; - // TODO policies, enrichers, feeds; bundles? - return null; + return lookup((o) -> { return type.isInstance(o) && Objects.equal(id, o.getId()); }); --- End diff -- `lookupAll` is inefficient, because we don't have indexes for policies/enrichers/feeds. You could guard this call, only doing it if `!(Entity.class.isAssignableFrom(type) || Location.class.isAssignableFrom(type))`. Longer term, we should see how often this is called with 1000s of entities - we'll make immutable copies of the various collections each time, iterating over them. But we can defer that, assuming it's not too bad just now?!
---