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

Ron Sigal ron_sigal at yahoo.com
Mon Aug 20 02:14:10 EDT 2007


  User: rsigal  
  Date: 07/08/20 02:14:10

  Modified:    src/main/org/jboss/remoting/transport/bisocket  Tag:
                        remoting_2_2_2_experimental
                        BisocketServerInvoker.java
  Log:
  JBREM-749:  Made port of secondary ServerInvoker configurable.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.17.2.7.2.1 +41 -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.7.2.1
  diff -u -b -r1.1.2.17.2.7 -r1.1.2.17.2.7.2.1
  --- BisocketServerInvoker.java	6 Aug 2007 03:57:44 -0000	1.1.2.17.2.7
  +++ BisocketServerInvoker.java	20 Aug 2007 06:14:10 -0000	1.1.2.17.2.7.2.1
  @@ -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.7.2.1 $
    * <p>
    * Copyright Nov 23, 2006
    * </p>
  @@ -84,6 +84,7 @@
      private int controlConnectionRestarts = Bisocket.MAX_CONTROL_CONNECTION_RESTARTS_DEFAULT;
      private ControlMonitorTimerTask controlMonitorTimerTask;
      protected boolean isCallbackServer = false;
  +   protected int secondaryPort = -1;
   
   
      public static BisocketServerInvoker getBisocketServerInvoker(String listenerId)
  @@ -175,22 +176,25 @@
         {
            super.start();
            InetAddress host = getServerSocket().getInetAddress();
  -         int freePort = PortUtil.findFreePort(host.getHostAddress());
  +         if (secondaryPort < 0)
  +         {
  +            secondaryPort = PortUtil.findFreePort(host.getHostAddress());
  +         }
            if (serverSocketFactory != null)
            {
  -            secondaryServerSocket = serverSocketFactory.createServerSocket(freePort, 0, host);
  +            secondaryServerSocket = serverSocketFactory.createServerSocket(secondaryPort, 0, host);
            }
            else
            {
  -            secondaryServerSocket = new ServerSocket(freePort, 0, host);
  +            secondaryServerSocket = new ServerSocket(secondaryPort, 0, host);
            }
            checkSecondaryServerSocketWrapper();
  -         secondaryLocator = new InvokerLocator(null, host.getHostAddress(), freePort, null, null);
  +         secondaryLocator = new InvokerLocator(null, host.getHostAddress(), secondaryPort, 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 + ":" + secondaryPort);
         }
      }
   
  @@ -374,6 +378,18 @@
      }
      
      
  +   public int getSecondaryPort()
  +   {
  +      return secondaryPort;
  +   }
  +   
  +   
  +   public void setSecondaryPort(int secondaryPort)
  +   {
  +      this.secondaryPort = secondaryPort;
  +   }
  +   
  +   
      public int getSocketCreationRetries()
      {
         return socketCreationRetries;
  @@ -438,6 +454,25 @@
         }
         
         pingWindow = pingWindowFactor * pingFrequency;
  +      
  +      o = configuration.get(Bisocket.SECONDARY_PORT);
  +      if (o instanceof String && ((String) o).length() > 0)
  +      {
  +            try
  +            {
  +               secondaryPort = Integer.valueOf(((String) o)).intValue();
  +               log.debug(this + " setting secondaryPort to " + secondaryPort);
  +            }
  +            catch (NumberFormatException e)
  +            {
  +               log.warn("Invalid format for " + "\"" + Bisocket.SECONDARY_PORT + "\": " + o);
  +            }
  +      }
  +      else if (o != null)
  +      {
  +         log.warn("\"" + Bisocket.SECONDARY_PORT + "\" must be specified as a String");
  +      }
  +      
         super.setup();
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list