[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/bisocket ...

Ron Sigal ron_sigal at yahoo.com
Wed Aug 22 23:07:22 EDT 2007


  User: rsigal  
  Date: 07/08/22 23:07:22

  Modified:    src/main/org/jboss/remoting/transport/bisocket  Tag:
                        remoting_2_2_0_GA BisocketServerInvoker.java
  Log:
  JBREM-749:  Merged changes from branch remoting_2_2_2_experimental.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.17.2.8 +75 -6     JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BisocketServerInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java,v
  retrieving revision 1.1.2.17.2.7
  retrieving revision 1.1.2.17.2.8
  diff -u -b -r1.1.2.17.2.7 -r1.1.2.17.2.8
  --- BisocketServerInvoker.java	6 Aug 2007 03:57:44 -0000	1.1.2.17.2.7
  +++ BisocketServerInvoker.java	23 Aug 2007 03:07:22 -0000	1.1.2.17.2.8
  @@ -58,7 +58,7 @@
   /**
    *
    * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  - * @version $Revision: 1.1.2.17.2.7 $
  + * @version $Revision: 1.1.2.17.2.8 $
    * <p>
    * Copyright Nov 23, 2006
    * </p>
  @@ -84,6 +84,8 @@
      private int controlConnectionRestarts = Bisocket.MAX_CONTROL_CONNECTION_RESTARTS_DEFAULT;
      private ControlMonitorTimerTask controlMonitorTimerTask;
      protected boolean isCallbackServer = false;
  +   protected int secondaryBindPort = -1;
  +   protected int secondaryConnectPort = -1;
   
   
      public static BisocketServerInvoker getBisocketServerInvoker(String listenerId)
  @@ -175,22 +177,28 @@
         {
            super.start();
            InetAddress host = getServerSocket().getInetAddress();
  -         int freePort = PortUtil.findFreePort(host.getHostAddress());
  +         if (secondaryBindPort < 0)
  +         {
  +            secondaryBindPort = PortUtil.findFreePort(host.getHostAddress());
  +         }
            if (serverSocketFactory != null)
            {
  -            secondaryServerSocket = serverSocketFactory.createServerSocket(freePort, 0, host);
  +            secondaryServerSocket = serverSocketFactory.createServerSocket(secondaryBindPort, 0, host);
            }
            else
            {
  -            secondaryServerSocket = new ServerSocket(freePort, 0, host);
  +            secondaryServerSocket = new ServerSocket(secondaryBindPort, 0, host);
            }
            checkSecondaryServerSocketWrapper();
  -         secondaryLocator = new InvokerLocator(null, host.getHostAddress(), freePort, null, null);
  +         
  +         String connectAddress = getLocator().getHost();
  +         int connectPort = secondaryConnectPort > 0 ? secondaryConnectPort : secondaryBindPort;
  +         secondaryLocator = new InvokerLocator(null, connectAddress, connectPort, null, null);
            secondaryServerSocketThread = new SecondaryServerSocketThread(secondaryServerSocket);
            secondaryServerSocketThread.setName("secondaryServerSocketThread");
            secondaryServerSocketThread.setDaemon(true);
            secondaryServerSocketThread.start();
  -         log.debug("started secondary port: " + host + ":" + freePort);
  +         log.debug("started secondary port: " + host + ":" + secondaryBindPort);
         }
      }
   
  @@ -374,6 +382,30 @@
      }
      
      
  +   public int getSecondaryBindPort()
  +   {
  +      return secondaryBindPort;
  +   }
  +   
  +   
  +   public void setSecondaryBindPort(int secondaryPort)
  +   {
  +      this.secondaryBindPort = secondaryPort;
  +   }
  +   
  +   
  +   public int getSecondaryConnectPort()
  +   {
  +      return secondaryConnectPort;
  +   }
  +   
  +   
  +   public void setSecondaryConnectPort(int secondaryConnectPort)
  +   {
  +      this.secondaryConnectPort = secondaryConnectPort;
  +   }
  +   
  +   
      public int getSocketCreationRetries()
      {
         return socketCreationRetries;
  @@ -438,6 +470,43 @@
         }
         
         pingWindow = pingWindowFactor * pingFrequency;
  +      
  +      o = configuration.get(Bisocket.SECONDARY_BIND_PORT);
  +      if (o instanceof String && ((String) o).length() > 0)
  +      {
  +            try
  +            {
  +               secondaryBindPort = Integer.valueOf(((String) o)).intValue();
  +               log.debug(this + " setting secondaryBindPort to " + secondaryBindPort);
  +            }
  +            catch (NumberFormatException e)
  +            {
  +               log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_BIND_PORT + "\": " + o);
  +            }
  +      }
  +      else if (o != null)
  +      {
  +         log.warn("\"" + Bisocket.SECONDARY_BIND_PORT + "\" must be specified as a String");
  +      }
  +      
  +      o = configuration.get(Bisocket.SECONDARY_CONNECT_PORT);
  +      if (o instanceof String && ((String) o).length() > 0)
  +      {
  +            try
  +            {
  +               secondaryConnectPort = Integer.valueOf(((String) o)).intValue();
  +               log.debug(this + " setting secondaryConnectPort to " + secondaryConnectPort);
  +            }
  +            catch (NumberFormatException e)
  +            {
  +               log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_CONNECT_PORT + "\": " + o);
  +            }
  +      }
  +      else if (o != null)
  +      {
  +         log.warn("\"" + Bisocket.SECONDARY_CONNECT_PORT + "\" must be specified as a String");
  +      }
  +      
         super.setup();
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list