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

    https://github.com/apache/brooklyn-server/pull/181#discussion_r65891907
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/location/access/BrooklynAccessUtils.java
 ---
    @@ -59,46 +60,52 @@
     
         public static HostAndPort getBrooklynAccessibleAddress(Entity entity, 
int port) {
             String host;
    -        
    +
    +        EntityInternal entityInternal = (EntityInternal) entity;
    +
             // look up port forwarding
             PortForwardManager pfw = entity.getConfig(PORT_FORWARDING_MANAGER);
    -        if (pfw!=null) {
    -            Collection<Location> ll = entity.getLocations();
    -            
    -            synchronized (BrooklynAccessUtils.class) {
    -                // TODO finer-grained synchronization
    -                
    -                for (MachineLocation machine : Iterables.filter(ll, 
MachineLocation.class)) {
    -                    HostAndPort hp = pfw.lookup(machine, port);
    +        if (pfw == null) {
    +            log.debug("No PortForwardManager, using default");
    +            pfw = (PortForwardManager) 
entityInternal.getManagementContext().getLocationRegistry().getLocationManaged("portForwardManager(scope=global)");
    +        }
    +
    +        Collection<Location> ll = entity.getLocations();
    +
    +        synchronized (BrooklynAccessUtils.class) {
    --- End diff --
    
    Do we need to check for null `pfw` here? Is it always there? What about 
non-jclouds locations?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to