0 Replies Latest reply on Oct 19, 2015 11:39 AM by tibu

    Group not populated until Cluster changes

    tibu

      Hello,

       

      we are working with Wildfly 9.0.1 and would like to monitor the cluster topology (whether or not a cluster is present, how many nodes, ...). We have a Listener impelementation for this task, that is attached to a org.wildfly.clustering.group.Group object, that is injected by the server. Its look kinda like this:

       

      @Resource(lookup = "java:jboss/clustering/group/ejb")
      private Group               group;
      
      ...
      @PostConstruct
      public void createListener()
      {
          group.addListener(new TopologyListener(group));
      }
      ...
      
      
      public class TopologyListener implements Listener{
      
          private boolean isCluster = false;
          
          public TopologyListener(Group group){
              isCluster = group.getNodes().size() > 1;
          }
      
          @Override
          public void membershipChanged(List<Node> previousMembers, List<Node> members, boolean merged)
          {
              isCluster = group.getNodes().size() > 1;
          }
      }
      
      
      
      
      
      

       

      With 8.2.0.Final this works fine:

      - When the first node starts, the node list is empty.

      - When the second node starts:

           - The list is at first empty at the second node, but it gets notified as soon as the cluster is formed

           - The first node is notified, too

       

      Now with 9.0.1 we have the problem, that the Group is empty at first on every "new" node, until another node joins or leaves the cluster. Even if we use a timer that queries the group every second, in the "newest" node the members list is always empty.

      For example, if we have nodes A, B and C started in alphabetical order, it behaves like this:

       

      A started -> A: isCluster == false

      B started -> A: isCluster == true; B: isCluster == false;

      C started -> A: isCluster == true; B: isCluster == true; C: isCluster == false;

      B stopped -> A: isCluster == true; C: isCluster == true;

       

      Does anybody have an idea how we could solve this issue? The listener is very important to us and at the moment we sadly have no chance yet to switch to WF 10...

       

      Best regards,

      Tibu