Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/878#discussion_r150097102
  
    --- Diff: 
api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java ---
    @@ -309,8 +310,14 @@
         /** As {@link #lookup(String, Class)} but not constraining the return 
type */
         public BrooklynObject lookup(String id);
         
    -    /** Finds an entity with the given ID known at this management context 
*/
    -    // TODO in future support policies etc
    +    /** As {@link #lookup(Predicate)} comparing the ID of the object with 
the given string */
         public <T extends BrooklynObject> T lookup(String id, Class<T> type); 
     
    -}
    \ No newline at end of file
    +    /** Finds a {@link BrooklynObject} known in this management context 
    +     * satisfying the given predicate, or null */
    +    public <T extends BrooklynObject> T lookup(Predicate<? super T> 
filter);
    --- End diff --
    
    I reviewed these same commits in 
https://github.com/apache/brooklyn-server/pull/879, and comments addressed 
there!
    * https://github.com/apache/brooklyn-server/pull/879#discussion_r149616384 
for marking these `@Beta` and discussion of `tryLookup` instead.
    * https://github.com/apache/brooklyn-server/pull/879#discussion_r149616593 
for discussion of performance of lookup (agree performance is probably ok - 
takes approx 1ms to look up a non-existent entity id when there are 1000 
entities). However, saying "only used for debugging and tests" is concerning - 
this is part of our public api so we should treat it as though users and other 
brooklyn developers will call it in all sorts of situations that we haven't 
thought of yet.


---

Reply via email to