brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #332: JcloudsLocation: Ability to supply extern...
Date Mon, 19 Sep 2016 17:57:57 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/332#discussion_r79450677
  
    --- Diff: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
---
    @@ -2862,7 +2863,37 @@ protected String getFirstReachableAddress(NodeMetadata node, ConfigBag
setup) {
             String result;
             if (enabled) {
                 Duration timeout = "true".equals(pollForFirstReachable) ? Duration.FIVE_MINUTES
: Duration.of(pollForFirstReachable);
    -            result = JcloudsUtil.getFirstReachableAddress(node, timeout);
    +
    +            Predicate<HostAndPort> pollForFirstReachableHostAndPortPredicate;
    +            if (setup.get(POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE) != null) {
    +                LOG.debug("Using pollForFirstReachableAddress.predicate supplied from
config for location " + this);
    +                pollForFirstReachableHostAndPortPredicate = setup.get(POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE);
    +            } else if (setup.get(POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE_TYPE) !=
null) {
    +                LOG.debug("Using pollForFirstReachableAddress.predicate.type supplied
from config for location " + this);
    +                ConfigBag args = new ConfigBag();
    +                final String reachablePredicatePrefix = POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE.getName()
+ ".";
    +                for (Map.Entry<ConfigKey<?>, ?> entry : setup.getAllConfigAsConfigKeyMap().entrySet())
{
    +                    String keyName = entry.getKey().getName();
    +                    if (keyName.startsWith(reachablePredicatePrefix)) {
    +                        args.putStringKey(Strings.removeFromStart(keyName, reachablePredicatePrefix),
entry.getValue());
    +                    }
    +                }
    +                pollForFirstReachableHostAndPortPredicate = Reflections.invokeConstructorFromArgs(setup.get(POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE_TYPE),
new Object[] {args.getAllConfig()}).get();
    +            } else {
    +                LOG.debug("Using default predicate for pollForFirstReachableAddress for
location " + this);
    +                pollForFirstReachableHostAndPortPredicate = new Predicate<HostAndPort>()
{
    --- End diff --
    
    Could also set is the default value on the `.type` key.


---
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