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


  
   public void testUsePreferredMasterViaAddress()
   {
      this.policy.setPreferredMaster("127.0.0.1:10002");
     
      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

      EasyMock.reset(this.partition, this.drm, this.lifecycle);
     
     
      // Test one replicant, was not old master, is not new master
     
      ClusterNode ourNode = EasyMock.createMock("ours", ClusterNode.class);
      ClusterNode otherNode = EasyMock.createMock("other", ClusterNode.class);
     
      nodes = Collections.singletonList(otherNode);
     
      EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(this.drm);
      EasyMock.expect(this.drm.lookupReplicantsNodes(SERVICE_HA_NAME)).andReturn(nodes);
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

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

       * @return a LockState with a lock count one higher than this one and with
       *         the current thread as latestRegistrant
       */
      private LockState register(ClusterNode registrant)
      {
         ClusterNode newHolder = (lockHolder == null && lastHolder == registrant) ? registrant : lockHolder;
         ClusterNode newLast = newHolder == null ? lastHolder : null;
         return new LockState(localLockCount + 1, newHolder, newLast, Thread.currentThread(), invalid);
      }
View Full Code Here

  
   // ------------------------------------------------------------------ Public
  
   public void unlock(Serializable lockId)
   {
      ClusterNode myself = getLocalClusterNode();
      if (myself == null)
      {
         throw new IllegalStateException("Must call start() before first call to unlock()");
      }
     
      ClusterLockState lockState = getClusterLockState(lockId, false);
     
      if (lockState != null && myself.equals(lockState.getHolder()))
      {
         getLocalHandler().unlockFromCluster(lockId, myself);
         lockState.release();
        
         try
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.