[Jboss-cvs] JBoss Messaging SVN: r1333 - in branches/Branch_1_0: docs/gettingstarted/en/modules src/main/org/jboss/jms/client/remoting

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 20 19:39:31 EDT 2006


Author: clebert.suconic at jboss.com
Date: 2006-09-20 19:39:29 -0400 (Wed, 20 Sep 2006)
New Revision: 1333

Modified:
   branches/Branch_1_0/docs/gettingstarted/en/modules/configuration.xml
   branches/Branch_1_0/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java
Log:
JBMESSAGING-431

Modified: branches/Branch_1_0/docs/gettingstarted/en/modules/configuration.xml
===================================================================
--- branches/Branch_1_0/docs/gettingstarted/en/modules/configuration.xml	2006-09-20 23:34:26 UTC (rev 1332)
+++ branches/Branch_1_0/docs/gettingstarted/en/modules/configuration.xml	2006-09-20 23:39:29 UTC (rev 1333)
@@ -669,5 +669,9 @@
 		Use java -Djboss.messaging.callback.bind.address=YourHost - That will determine the callBack host in your client.
       </para>
 
+      <para>
+		The client port will be selected randomically for any non used port. But if you defined -Djboss.messaging.callback.bind.port=NumericPort in your System Properties that number is going to be used for the call back client port.
+      </para>
+
   </section>
 </chapter>

Modified: branches/Branch_1_0/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java
===================================================================
--- branches/Branch_1_0/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java	2006-09-20 23:34:26 UTC (rev 1332)
+++ branches/Branch_1_0/src/main/org/jboss/jms/client/remoting/CallbackServerFactory.java	2006-09-20 23:39:29 UTC (rev 1333)
@@ -62,6 +62,31 @@
 
    public static final String CLIENT_HOST =
       System.getProperty("jboss.messaging.callback.bind.address");
+   
+   public static final int CLIENT_PORT = getPort();
+   
+   private static int getPort()
+   {
+	   String propertyPort = System.getProperty("jboss.messaging.callback.bind.port");
+	   
+	   try
+	   {
+		   if (propertyPort!=null)
+		   {
+			   return Integer.parseInt(propertyPort);
+		   }
+		   else
+		   {
+			   return -1;
+		   }
+	   }
+	   catch (Exception e)
+	   {
+		   log.warn("Error during parsing jboss.messaging.callback.bind.port", e);
+		   return -1;
+	   }
+	   
+   }
 
    public static CallbackServerFactory instance = new CallbackServerFactory();
 
@@ -147,8 +172,12 @@
       {
          try
          {      
-            int bindPort = PortUtil.findFreePort(thisAddress);
-      
+            int bindPort = CLIENT_PORT;
+            if (bindPort<=0)
+            {
+            	bindPort=PortUtil.findFreePort(thisAddress);
+            }
+            
             String callbackServerURI;
       
             if (isSSL)




More information about the jboss-cvs-commits mailing list