1 Reply Latest reply on May 15, 2014 6:03 PM by pferraro

    How to stop singleton service programmatically in jboss 7.1.1

    prabus.4797

      When split brain issue happens (due to network issue), each node in cluster forms its own cluster group and start acting as master node (running singleton service provider). Once network issue resolved, all nodes get merged and form single cluster again. At this point ideally only one singleton service provider should be running, but in Jboss 7.1.1, it continues to run into multiple master mode. This issue fixed in 7.1.3 ([AS7-5218] SingletonService is not stopped after cluster split/merge - JBoss Issue Tracker)

       

      But we cannot move to Jboss 7.1.3, so we are trying alternate options. We are using GroupMemebershipListener to track cluster merge event and wanted to stop singleton service other than master node.

       

      Is there way we call this through programmatically to do?

        • 1. Re: How to stop singleton service programmatically in jboss 7.1.1
          pferraro

          To solve the split brain scenario, you effectively want to require a quorum (i.e. a minimum membership size) before proceeding with a singleton master election.  This is implemented in WildFly.  You can probably implement something similar in AS 7.1.1 via a custom election policy.

          e.g.

          public class QuorumSingletonElectionPolicy implements SingletonElectionPolicy {
               private final SingletonElectionPolicy policy;
               private final int quorum;
          
               public QuorumSingletonElectionPolicy(SingletonElectionPolicy policy, int quorum) {
                    this.policy = policy;
                    this.quorum = quorum;
               }
          
               @Override
               public ClusterNode elect(List<ClusterNode> candidates) {
                    return (candidates.size() >= this.quorum) ? this.policy.elect(candidates) : null;
               }
          }
          
          
          

           

          It's a bit of a hack, but it ought to work.