1 Reply Latest reply on Jun 18, 2004 4:08 PM by Volker

    LoadBalancePolicy with preferred server, how to implement?

    Volker Newbie

      I have a jboss cluster (3.2.4) up and running. For performance reasons I would like to direct client access (SFSB) to only one of the servers. Can anyone please point me to a solution for that?

      I started with a clone of FirstAvailable.java, but I'm hanging in retrieving the information from the targets (where a TCPEndpoint is given behind some refs) within the chooseTarget() method. My idea was to access the ip-address from the targets and compare it to a system property value denoting the preferred server. Obviously my rmi knowledge is to weak here.

      Any help is highly appreciated


        • 1. Re: LoadBalancePolicy with preferred server, how to implemen
          Volker Newbie

          OK, found it myself. Reached out to far, trying to get that IP address.

          It is much easier, just have to see it ...

          Here is my solution, partial code of a copy of FirstAvailable.chooseTarget():

           if (targets.size() == 0)
           return null;
           String prefServer = System.getProperty("my.prefserver");
           if (prefServer != null) {
           // preferred server set, find server in targets and set it as target
           String serverName = null;
           Object targetObj=null;
           for (Iterator it = targets.iterator(); it.hasNext();) {
           try {
           targetObj = it.next();
           JRMPInvoker_Stub ji = ((JRMPInvoker_Stub) targetObj);
           serverName = ji.getServerHostName();
           log.debug("Found server in cluster "+serverName);
           } catch (Exception ex) {
           log.error("Exception hit ", ex);
           if (serverName.equals(prefServer)) {
           log.debug("Set server! " + serverName);
           this.electedTarget = targetObj;