brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Adds addAssociationListener and r...
Date Tue, 03 Mar 2015 16:14:25 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/538#discussion_r25700196
  
    --- Diff: core/src/main/java/brooklyn/location/access/PortForwardManagerImpl.java ---
    @@ -181,6 +188,20 @@ protected void associateImpl(String publicIpId, HostAndPort publicEndpoint,
Loca
             onChanged();
         }
     
    +    private void emitAssociationCreatedEvent(String publicIpId, HostAndPort publicEndpoint,
Location location, int privatePort) {
    +        AssociationMetadata metadata = new AssociationMetadata(publicIpId, publicEndpoint,
location, privatePort);
    +        for (Map.Entry<AssociationListener, Predicate<? super AssociationMetadata>>
entry : associationListeners.entrySet()) {
    +            if (entry.getValue().apply(metadata)) {
    +                try {
    +                    entry.getKey().onAssociationCreated(metadata);
    +                } catch (Exception e) {
    +                    Exceptions.propagateIfFatal(e);
    +                    log.warn("Exception thrown when emitting association creation event
{}: {}", metadata, e);
    --- End diff --
    
    This will just give the toString of the exception, rather than the stacktrace - it would
make debugging problems very hard. For example, it might tell you there was an NPE without
ever telling you which line that null pointer happened on. Suggest changing it to:
    
        log.warn("Exception thrown when emitting association creation event "+metadata, e);
    
    Same for log message in `emitAssociationDeletedEvent`.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message