Package org.jboss.ha.client.loadbalance

Examples of org.jboss.ha.client.loadbalance.LoadBalancePolicy


      // Get Interceptors
      Interceptor[] interceptors = this.getInterceptors();

      Class<? extends LoadBalancePolicy> policyClass = isOnlyHome ? beanClusteringInfo.getHomeLoadBalancePolicy() : beanClusteringInfo.getLoadBalancePolicy();
      LoadBalancePolicy lbp;
      try
      {
         lbp = policyClass.newInstance();
      }
      catch (Exception e)
View Full Code Here


      // Get Interceptors
      Interceptor[] interceptors = this.getInterceptors();

      Class<? extends LoadBalancePolicy> policyClass = isOnlyHome ? beanClusteringInfo.getHomeLoadBalancePolicy() : beanClusteringInfo.getLoadBalancePolicy();
      LoadBalancePolicy lbp;
      try
      {
         lbp = policyClass.newInstance();
      }
      catch (Exception e)
View Full Code Here

      // Get Interceptors
      Interceptor[] interceptors = this.getInterceptors();

      Class<? extends LoadBalancePolicy> policyClass = isOnlyHome ? beanClusteringInfo.getHomeLoadBalancePolicy() : beanClusteringInfo.getLoadBalancePolicy();
      LoadBalancePolicy lbp;
      try
      {
         lbp = policyClass.newInstance();
      }
      catch (Exception e)
View Full Code Here

/*     */   }
/*     */
/*     */   public Object invoke(Invocation invocation)
/*     */     throws Throwable
/*     */   {
/*  53 */     LoadBalancePolicy lb = (LoadBalancePolicy)invocation.getMetaData("CLUSTERED_REMOTING", "LOADBALANCE_POLICY");
/*  54 */     FamilyWrapper family = (FamilyWrapper)invocation.getMetaData("CLUSTERED_REMOTING", "CLUSTER_FAMILY_WRAPPER");
/*     */
/*  59 */     int failoverCounter = 0;
/*  60 */     String familyName = family.get().getFamilyName();
/*  61 */     invocation.getMetaData().addMetaData("CLUSTERED_REMOTING", "CLUSTER_FAMILY", familyName, PayloadKey.AS_IS);
/*  62 */     InvokerLocator target = (InvokerLocator)lb.chooseTarget(family.get());
/*  63 */     Throwable lastException = null;
/*  64 */     while (target != null)
/*     */     {
/*  66 */       invocation.getMetaData().addMetaData("CLUSTERED_REMOTING", "FAILOVER_COUNTER", new Integer(failoverCounter), PayloadKey.AS_IS);
/*  67 */       invocation.getMetaData().addMetaData("REMOTING", "INVOKER_LOCATOR", target, PayloadKey.AS_IS);
/*  68 */       invocation.getMetaData().addMetaData("CLUSTERED_REMOTING", "CLUSTER_VIEW_ID", new Long(family.get().getCurrentViewId()), PayloadKey.AS_IS);
/*     */
/*  70 */       boolean definitivlyRemoveNodeOnFailure = true;
/*  71 */       lastException = null;
/*     */       try
/*     */       {
/*  77 */         Object rsp = invocation.invokeNext();
/*  78 */         ArrayList newReplicants = (ArrayList)invocation.getResponseAttachment("replicants");
/*  79 */         if (newReplicants != null)
/*     */         {
/*  81 */           long newViewId = ((Long)invocation.getResponseAttachment("viewId")).longValue();
/*  82 */           family.get().updateClusterInfo(newReplicants, newViewId);
/*     */         }
/*  84 */         return rsp;
/*     */       }
/*     */       catch (DispatcherConnectException dce)
/*     */       {
/*  91 */         lastException = dce;
/*     */       }
/*     */       catch (CannotConnectException ex)
/*     */       {
/*  95 */         lastException = ex;
/*     */       }
/*     */       catch (GenericClusteringException gce)
/*     */       {
/*  99 */         lastException = gce;
/*     */
/* 104 */         if (gce.getCompletionStatus() == 1)
/*     */         {
/* 109 */           if (family.get().getTargets().size() >= failoverCounter)
/*     */           {
/* 111 */             if (!gce.isDefinitive()) {
/* 112 */               definitivlyRemoveNodeOnFailure = false;
/*     */             }
/*     */           }
/*     */         }
/*     */         else {
/* 117 */           throw new RuntimeException("Clustering exception thrown", gce);
/*     */         }
/*     */
/*     */       }
/*     */       catch (Throwable t)
/*     */       {
/* 125 */         if ((t.getCause() instanceof GenericClusteringException))
/*     */         {
/* 127 */           GenericClusteringException gce = (GenericClusteringException)t.getCause();
/* 128 */           lastException = gce;
/*     */
/* 133 */           if (gce.getCompletionStatus() == 1)
/*     */           {
/* 138 */             if (family.get().getTargets().size() >= failoverCounter)
/*     */             {
/* 140 */               if (!gce.isDefinitive()) {
/* 141 */                 definitivlyRemoveNodeOnFailure = false;
/*     */               }
/*     */             }
/*     */           }
/*     */           else
/* 146 */             throw new RuntimeException("Clustering exception thrown", gce);
/*     */         }
/*     */         else
/*     */         {
/* 150 */           throw t;
/*     */         }
/*     */
/*     */       }
/*     */
/* 155 */       family.get().removeDeadTarget(target);
/* 156 */       if (!definitivlyRemoveNodeOnFailure)
/*     */       {
/* 158 */         family.get().resetView();
/*     */       }
/*     */
/* 161 */       target = (InvokerLocator)lb.chooseTarget(family.get());
/* 162 */       if (target == null)
/*     */       {
/* 164 */         if (lastException != null)
/*     */         {
/* 166 */           throw new RuntimeException("cluster invocation failed, last exception was: ", lastException);
View Full Code Here

      super.start();
     
      // Set up the proxy to ourself. Needs to be clustered so it can load
      // balance requests (EJBTHREE-1375). We use the home load balance policy.
     
      LoadBalancePolicy factoryLBP = null;
      if (clustered.homeLoadBalancePolicy() == null || clustered.homeLoadBalancePolicy().equals(ClusteredDefaults.LOAD_BALANCE_POLICY_DEFAULT))
      {
         factoryLBP = new RoundRobin();
      }
      else
View Full Code Here

      this.rmiserver = new HARMIServerImpl(this.clusterPartition, this.replicantName, Naming.class,
         this.theServer, this.rmiPort, this.clientSocketFactory, this.serverSocketFactory, this.rmiBindAddress);

      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      Class<?> clazz = cl.loadClass(this.loadBalancePolicy);
      LoadBalancePolicy policy = (LoadBalancePolicy)clazz.newInstance();

      Naming proxy = (Naming) this.rmiserver.createHAStub(policy);
      return proxy;
   }
View Full Code Here

TOP

Related Classes of org.jboss.ha.client.loadbalance.LoadBalancePolicy

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.