brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grkvlt <>
Subject [GitHub] incubator-brooklyn pull request: Start BrooklynNode appplication
Date Tue, 30 Sep 2014 14:27:27 GMT
Github user grkvlt commented on a diff in the pull request:
    --- Diff: core/src/main/java/brooklyn/event/basic/
    @@ -94,14 +94,15 @@ protected Integer convertConfigToSensor(PortRange value, Entity entity)
                 if (lo.isPresent()) {
                     Location l = lo.get();
                     Boolean skip = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION)).or(false);
    +                Boolean started = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED)).or(false);
                     if (l instanceof PortSupplier) {
                         int p = ((PortSupplier) l).obtainPort(value);
                         if (p != -1) {
                             LOG.debug("{}: choosing port {} for {}", new Object[] { entity,
p, getName() });
                             return p;
    -                    // If we are not skipping install, fail now
    -                    if (!skip) {
    +                    // If we are not skipping install or already started, fail now
    +                    if (!(skip || started)) {
    --- End diff --
    No, what happens is that `obtainPort()` will fail and return -1if the port is being used.
We check if the _skip install_ or _already started_ flags are set, because in those cases
the entity is running, and is using the port, so we _don't_ return null for an error, but
just assume the first port in the range is what the entity is using. I know this isn't always
perfect, but we can assume that if there is a configured port then that configuration is correct...

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

View raw message