Package org.jboss.ha.framework.interfaces

Examples of org.jboss.ha.framework.interfaces.ClusterNode


   public void testUsePreferredMasterViaHost()
   {
      this.policy.setPreferredMaster("localhost:10001");
     
      ClusterNode master = this.policy.elect(this.candidates);
     
      Assert.assertSame(this.candidates.get(1), master);
   }
View Full Code Here


     if (System.getProperty("java.net.preferIPv4Stack").equals("true"))
       hostport = "127.0.0.1:10002" ;
    
      this.policy.setPreferredMaster(hostport);
     
      ClusterNode master = this.policy.elect(this.candidates);
     
      Assert.assertSame(this.candidates.get(2), master);
   }
View Full Code Here

  
   public void testUseDefaultMaster()
   {
      this.policy.setPreferredMaster("localhost:10003");
     
      ClusterNode master = this.policy.elect(this.candidates);
     
      Assert.assertSame(this.candidates.get(0), master);
     
      this.policy.setPosition(1);
     
View Full Code Here

      Assert.assertSame(this.candidates.get(1), master);
   }
  
   public void testUseDefaultMasterNoPreference()
   {
      ClusterNode master = this.policy.elect(this.candidates);
     
      Assert.assertSame(this.candidates.get(0), master);
     
      this.policy.setPosition(1);
     
View Full Code Here

  
   public void testUseDefaultMasterEmptyPreference()
   {
      this.policy.setPreferredMaster("");
     
      ClusterNode master = this.policy.elect(this.candidates);
     
      Assert.assertSame(this.candidates.get(0), master);
     
      this.policy.setPosition(1);
     
View Full Code Here

      log.debug("+++ testKeyListenerDeadlock()");
     
      MBeanServer mbeanServer =
         MBeanServerFactory.createMBeanServer("mockPartition");
      try {
         ClusterNode localAddress = factory.getClusterNode(new IpAddress("localhost", 12345));
         MockHAPartition partition = new MockHAPartition(localAddress);
     
         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);

         drm.createService();
View Full Code Here

      log.debug("+++ testRemoteCallBlocking()");
     
      MBeanServer mbeanServer =
         MBeanServerFactory.createMBeanServer("mockPartition");
      try {
         ClusterNode localAddress = factory.getClusterNode(new IpAddress("localhost", 12345));
         MockHAPartition partition = new MockHAPartition(localAddress);
     
         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);

         drm.createService();
View Full Code Here

     
      MBeanServer mbeanServer =
         MBeanServerFactory.createMBeanServer("mockPartition");
      try {
       
         ClusterNode localAddress = factory.getClusterNode(new IpAddress("localhost", 12345));
         MockHAPartition partition = new MockHAPartition(localAddress);
     
         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);

         drm.createService();
        
         // Create a fake view for the MockHAPartition
        
         Vector<ClusterNode> remoteAddresses = new Vector<ClusterNode>();
         ClusterNode remote = factory.getClusterNode(new IpAddress("localhost", 12341));
         remoteAddresses.add(remote);
        
         Vector<ClusterNode> allNodes = new Vector<ClusterNode>(remoteAddresses);
         allNodes.add(localAddress);
         partition.setCurrentViewClusterNodes(allNodes);
        
         drm.startService();
        
         MockDeployer deployer = new MockDeployer(drm);
        
         if (!conflicting)
         {
            // Register a MockHASingletonDeployer, but since we're in
            // non-conflicting mode, the DeployerThreads won't deal with it
            MockHASingletonDeployer listener =
                  new MockHASingletonDeployer(deployer, "HASingleton", log);
           
            drm.registerListener("HASingleton", listener);
            drm.add("HASingleton", "HASingleton");           
         }
        
         // Create a semaphore to gate the threads and acquire all its permits
         Semaphore semaphore = new Semaphore(count + 1);
         for (int i = 0; i <= count; i++)
            semaphore.acquire();
        
         DeployerThread[] deployers = new DeployerThread[keys.length];
         for (int i = 0; i < count; i++)
         {
            DistributedReplicantManager.ReplicantListener listener = null;
            if (conflicting)
            {
               listener = new MockHASingletonDeployer(deployer, keys[i], log);
            }
            else
            {
               listener = new NullListener();
            }
            deployers[i] = new DeployerThread(deployer, keys[i], listener, semaphore, log);
            deployers[i].start();
         }
        
         String[] jgKeys = keys;
         if (!conflicting)
         {
            // The JGroups thread also deals with the MockHASingletonDeployer
            // key that the DeployerThreads don't
            jgKeys = new String[keys.length + 1];
            System.arraycopy(keys, 0, jgKeys, 0, keys.length);
            jgKeys[keys.length] = "HASingleton";           
         }
         JGroupsThread jgThread = new JGroupsThread(drm, jgKeys, remote.getName(), semaphore);
         jgThread.start();
        
         // Launch the threads
         semaphore.release(count + 1);
        
View Full Code Here

      if (this.electionPolicy == null)
      {
         return this.isDRMMasterReplica();
      }
     
      ClusterNode electedNode = this.election();
     
      return (electedNode != null) ? electedNode.equals(this.getHAPartition().getClusterNode()) : false;
   }
View Full Code Here

      log.debug("RPCTestCase.startService() - " + rpcServiceName);
     
      if (partition == null)
         throw new IllegalStateException("RPCUser partition is null");

      ClusterNode me = partition.getClusterNode();
      ClusterNode[] nodes = partition.getClusterNodes();
      boolean isFirstNode = (nodes != null && nodes[0].equals(me));
     
      // register the service with the partition
      // note that "OneNode" services are only registered on the first node
View Full Code Here

TOP

Related Classes of org.jboss.ha.framework.interfaces.ClusterNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.