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

    https://github.com/apache/incubator-brooklyn/pull/144#discussion_r17107160
  
    --- Diff: 
software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakClusterImpl.java ---
    @@ -108,49 +107,45 @@ protected synchronized void 
onServerPoolMemberChanged(Entity member) {
                 // TODO can we discover the nodes by asking the riak cluster, 
rather than assuming what we add will be in there?
                 // TODO and can we do join as part of node starting?
     
    -            if (nodes == null) nodes = Maps.newLinkedHashMap();
    +            if (nodes == null) {
    +                nodes = Maps.newLinkedHashMap();
    +            }
    +            
                 String riakName = getRiakName(member);
    +            Preconditions.checkNotNull(riakName);
     
    -            if (riakName == null) {
    -                log.error("Unable to get riak name for node: {}", 
member.getId());
    -            } else {
    -                //flag a first node to be the first node in the riak 
cluster.
    -                if (!isFirstNodeSet.get()) {
    -                    nodes.put(member, riakName);
    -                    setAttribute(RIAK_CLUSTER_NODES, nodes);
    -
    -                    ((EntityInternal) 
member).setAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER, Boolean.TRUE);
    -                    isFirstNodeSet.set(true);
    -
    -                    log.info("Adding riak node {}: {}; {} to cluster", new 
Object[]{this, member, getRiakName(member)});
    +            // flag a first node to be the first node in the riak cluster.
    +            if (!isFirstNodeSet.getAndSet(true)) {
    --- End diff --
    
    There is now an attribute `DynamicCluster.FIRST_MEMBER` that will be set to 
true if a node is first in a cluster. Also `DynamicCluster.CLUSTER_MEMBER` is 
true if the node is in a cluster, unset otherwise. Finally, 
`DynamicCluster.CLUSTER` on a clustered node gives the cluster entity itself, 
and then `DynamicCluster.FIRST` on that will give the first node entity, so 
other nodes can use this to find it...


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

Reply via email to