Package org.jboss.ha.client.loadbalance

Examples of org.jboss.ha.client.loadbalance.LoadBalancePolicy.chooseTarget()


         {
            target = (InvokerLocator) ((AopLoadBalancePolicy) lb).chooseTarget(family.get(), invocation);
         }
         else
         {
            target = (InvokerLocator) lb.chooseTarget(family.get());
         }
      }
     
      Throwable lastException = null;
      boolean failoverAuthorized = true;
View Full Code Here


         if (!definitivlyRemoveNodeOnFailure)
         {
            family.get().resetView();
         }

         target = (InvokerLocator) lb.chooseTarget(family.get());
         if (target == null)
         {
            if (lastException != null)
            {
               throw new RuntimeException("cluster invocation failed, last exception was: ", lastException);
View Full Code Here

      FamilyClusterInfo fci = ClusteringTargetsRepository.initTarget(FAMILY_BASE + testCount, Arrays.asList(TARGETS));
      LoadBalancePolicy lbp = getLoadBalancePolicy();
      int expectedCursor = -1;
      for (int i = 0; i < 100; i++)
      {
         Object target = lbp.chooseTarget(fci);
         if (expectedCursor < 0)
         {
            expectedCursor = fci.getCursor();
         }
         else
View Full Code Here

      testCount++;
      List<String> targets = new ArrayList<String>(Arrays.asList(TARGETS));
      FamilyClusterInfo fci = ClusteringTargetsRepository.initTarget(FAMILY_BASE + testCount, targets);
      LoadBalancePolicy lbp = getLoadBalancePolicy();
     
      String target = (String) lbp.chooseTarget(fci);
      int cursor = fci.getCursor();
      assertEquals(target, fci.getTargets().get(cursor));
     
      while (targets.size() > 1)
      {
View Full Code Here

         targets.remove(target);
         assertEquals(targets, fci.getTargets());
        
         int expectedCursor = ++cursor % targets.size();
        
         target = (String) lbp.chooseTarget(fci);
         cursor = fci.getCursor();
         assertEquals(expectedCursor, cursor);
         assertEquals(target, fci.getTargets().get(cursor));
      }
   }
View Full Code Here

      testCount++;
      List<String> targets = Arrays.asList(TARGETS);
      FamilyClusterInfo fci = ClusteringTargetsRepository.initTarget(FAMILY_BASE + testCount, targets);
      LoadBalancePolicy lbp = getLoadBalancePolicy();
     
      String target = (String) lbp.chooseTarget(fci);
      int cursor = fci.getCursor();
      assertEquals(target, fci.getTargets().get(cursor));
     
      targets = Arrays.asList(new String[]{"W", "X", "Y", "Z"});
      fci.updateClusterInfo(targets, 1);
View Full Code Here

      targets = Arrays.asList(new String[]{"W", "X", "Y", "Z"});
      fci.updateClusterInfo(targets, 1);
     
      int expectedCursor = ++cursor % targets.size();
     
      target = (String) lbp.chooseTarget(fci);
      cursor = fci.getCursor();
      assertEquals(expectedCursor, cursor);
      assertEquals(target, targets.get(cursor));
   }
View Full Code Here

      Set<Object> selected = new HashSet<Object>();
      LoadBalancePolicy lbp = getLoadBalancePolicy();
     
      for (int i = 0; i < 10000; i++)
      {
         selected.add(lbp.chooseTarget(fci));
         if (selected.size() == TARGETS.length)
            break;
      }
     
      assertEquals(TARGETS.length, selected.size());
View Full Code Here

      testCount++;
      List<String> targets = new ArrayList<String>(Arrays.asList(TARGETS));
      FamilyClusterInfo fci = ClusteringTargetsRepository.initTarget(FAMILY_BASE + testCount, targets);
      LoadBalancePolicy lbp = getLoadBalancePolicy();
     
      String target = (String) lbp.chooseTarget(fci);
      assertTrue(targets.contains(target));
     
      while (targets.size() > 1)
      {
         fci.removeDeadTarget(target);
View Full Code Here

      {
         fci.removeDeadTarget(target);
         targets.remove(target);
         assertEquals(targets, fci.getTargets());
        
         target = (String) lbp.chooseTarget(fci);
         assertTrue(targets.contains(target));
      }
   }

   public void testTopologyChange()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.