Package org.jboss.ha.framework.interfaces

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


  
   // ------------------------------------------------------ ClusterLockManager
  
   public void unlock(Serializable lockId)
   {
      ClusterNode myself = getLocalClusterNode();
      if (myself == null)
      {
         throw new IllegalStateException("Must call start() before first call to unlock()");
      }
     
      ClusterLockState category = getClusterLockState(lockId, false);
     
      if (category == null)
      {
         getLocalHandler().unlockFromCluster(lockId, myself);
      }
      else if (myself.equals(category.getHolder()))
      {
         category.invalidate();
         getLocalHandler().unlockFromCluster(lockId, myself);
         removeLockState(category);
      }
View Full Code Here


      long start = System.currentTimeMillis();
      while (left > 0)
      {
         // Another node we lost to who should take precedence
         // over ourself in competition for the lock
         ClusterNode superiorCompetitor = null;
        
         // Only continue if category is unlocked
         if (category.state.compareAndSet(ClusterLockState.State.UNLOCKED, ClusterLockState.State.REMOTE_LOCKING))
         {           
            // Category state is now REMOTE_LOCKING, so other nodes will fail
View Full Code Here

      if (this.electionPolicy == null)
      {
         result = this.isDRMMasterReplica();
      }
      else {
         ClusterNode electedNode = this.election();
         result = (electedNode != null) ? electedNode.equals(this.getHAPartition().getClusterNode()) : false;
      }
      if( log.isDebugEnabled())
      {
         log.debug("election result =" + result + ", electionPolicy=" +
         (electionPolicy != null? electionPolicy.getClass().getName():"DistributedReplicantManager"));
View Full Code Here

       * @return a LockState with a lock count one higher than this one and with
       *         the current thread as latestRegistrant
       */
      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
  
   @Override
   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

   // ------------------------------------------------------ ClusterLockManager
  
   @Override
   public void unlock(Serializable lockId)
   {
      ClusterNode myself = getLocalClusterNode();
      if (myself == null)
      {
         throw new IllegalStateException("Must call start() before first call to unlock()");
      }
     
      ClusterLockState category = getClusterLockState(lockId, false);
     
      if (category == null)
      {
         getLocalHandler().unlockFromCluster(lockId, myself);
      }
      else if (myself.equals(category.getHolder()))
      {
         category.invalidate();
         getLocalHandler().unlockFromCluster(lockId, myself);
         removeLockState(category);
      }
View Full Code Here

      long start = System.currentTimeMillis();
      while (left > 0)
      {
         // Another node we lost to who should take precedence
         // over ourself in competition for the lock
         ClusterNode superiorCompetitor = null;
        
         // Only continue if category is unlocked
         if (category.state.compareAndSet(ClusterLockState.State.UNLOCKED, ClusterLockState.State.REMOTE_LOCKING))
         {           
            // Category state is now REMOTE_LOCKING, so other nodes will fail
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

      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

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.