You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by "TULK, Daniel, FM" <Da...@rbos.com> on 2003/06/05 15:43:44 UTC

[Patch] Phoenix MX4JSystemManager - configurable MX4J rmiregistry port

Hi,

The patch lets you pick the port that the RMI registry MX4J starts is on
when using the RMI adaptor. If you don't pick one it defaults to 1099. To
specify the port add <rmi-registry-port>1098</rmi-registry-port> in the
SystemManager section of kernel.xml.

The patchfile.txt should be attached, if not I've inlined at anyway

Cheers

Dan

-----------------
- patchfile.txt -
-----------------

--- MX4JSystemManager.java.original	Thu Jun 05 13:29:10 2003
+++ MX4JSystemManager.java.patched	Thu Jun 05 12:30:26 2003
@@ -89,12 +89,15 @@
     private static final String DEFAULT_NAMING_FACTORY =
         "com.sun.jndi.rmi.profile.RegistryContextFactory";
     private static final String DEFAULT_HTTPADAPTER_HOST = "localhost";
-    private static final int DEFAULT_HTTPADAPTER_PORT =
-        Integer.getInteger( "phoenix.adapter.http", 8082 ).intValue();
+	private static final int DEFAULT_HTTPADAPTER_PORT =
+		Integer.getInteger( "phoenix.adapter.http", 8082
).intValue();
+	private static final int DEFAULT_RMIREGISTRY_PORT =
+		Integer.getInteger( "phoenix.rmiregistry.port", 1099
).intValue();
 
     private String m_host;
     private int m_port;
     private boolean m_rmi;
+    private int m_rmi_registry_port;
     private File m_homeDir;
     private String m_stylesheetDir;
     private String m_namingFactory;
@@ -125,6 +128,7 @@
         getLogger().debug( "MX4J HTTP listener port: " + m_port );
 
         m_rmi = configuration.getChild( "enable-rmi-adaptor"
).getValueAsBoolean( false );
+        m_rmi_registry_port =
configuration.getChild("rmi-registry-port").getValueAsInteger(DEFAULT_RMIREG
ISTRY_PORT);
         m_http = configuration.getChild( "enable-http-adaptor"
).getValueAsBoolean( false );
 
         m_namingFactory =
@@ -241,7 +245,12 @@
     {
         // Create and start the naming service
         final ObjectName naming = new ObjectName( "Naming:type=rmiregistry"
);
-        server.createMBean( "mx4j.tools.naming.NamingService", naming, null
);
+        server.createMBean(	"mx4j.tools.naming.NamingService", 
+        					naming,
+        					null, 
+        					new Object[] {new
Integer(m_rmi_registry_port)}, 
+        					new String[] {"int"}
+        					);
         server.invoke( naming, "start", null, null );
 
         // Create the JRMP adaptor
@@ -256,6 +265,8 @@
 
         mbean.putJNDIProperty(
javax.naming.Context.INITIAL_CONTEXT_FACTORY,
                                m_namingFactory );
+		mbean.putJNDIProperty(javax.naming.Context.PROVIDER_URL,
"rmi://localhost:" + m_rmi_registry_port);
+
         // Register the JRMP adaptor in JNDI and start it
         mbean.start();
     }

---------------------
- End patchfile.txt -
---------------------



********************************************************************
      Visit our Internet site at http://www.rbsmarkets.com

This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
The Royal Bank of Scotland plc is registered in Scotland No 90312
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB
Regulated by the Financial Services Authority
********************************************************************

Re: [Patch] Phoenix MX4JSystemManager - configurable MX4J rmiregistry port

Posted by Peter Donald <pe...@realityforge.org>.
Applied - thanks!

On Thu, 5 Jun 2003 11:43 pm, TULK, Daniel, FM wrote:
> Hi,
>
> The patch lets you pick the port that the RMI registry MX4J starts is on
> when using the RMI adaptor. If you don't pick one it defaults to 1099. To
> specify the port add <rmi-registry-port>1098</rmi-registry-port> in the
> SystemManager section of kernel.xml.
>
> The patchfile.txt should be attached, if not I've inlined at anyway
>
> Cheers
>
> Dan
>
> -----------------
> - patchfile.txt -
> -----------------
>
> --- MX4JSystemManager.java.original	Thu Jun 05 13:29:10 2003
> +++ MX4JSystemManager.java.patched	Thu Jun 05 12:30:26 2003
> @@ -89,12 +89,15 @@
>      private static final String DEFAULT_NAMING_FACTORY =
>          "com.sun.jndi.rmi.profile.RegistryContextFactory";
>      private static final String DEFAULT_HTTPADAPTER_HOST = "localhost";
> -    private static final int DEFAULT_HTTPADAPTER_PORT =
> -        Integer.getInteger( "phoenix.adapter.http", 8082 ).intValue();
> +	private static final int DEFAULT_HTTPADAPTER_PORT =
> +		Integer.getInteger( "phoenix.adapter.http", 8082
> ).intValue();
> +	private static final int DEFAULT_RMIREGISTRY_PORT =
> +		Integer.getInteger( "phoenix.rmiregistry.port", 1099
> ).intValue();
>
>      private String m_host;
>      private int m_port;
>      private boolean m_rmi;
> +    private int m_rmi_registry_port;
>      private File m_homeDir;
>      private String m_stylesheetDir;
>      private String m_namingFactory;
> @@ -125,6 +128,7 @@
>          getLogger().debug( "MX4J HTTP listener port: " + m_port );
>
>          m_rmi = configuration.getChild( "enable-rmi-adaptor"
> ).getValueAsBoolean( false );
> +        m_rmi_registry_port =
> configuration.getChild("rmi-registry-port").getValueAsInteger(DEFAULT_RMIRE
>G ISTRY_PORT);
>          m_http = configuration.getChild( "enable-http-adaptor"
> ).getValueAsBoolean( false );
>
>          m_namingFactory =
> @@ -241,7 +245,12 @@
>      {
>          // Create and start the naming service
>          final ObjectName naming = new ObjectName(
> "Naming:type=rmiregistry" );
> -        server.createMBean( "mx4j.tools.naming.NamingService", naming,
> null );
> +        server.createMBean(	"mx4j.tools.naming.NamingService",
> +        					naming,
> +        					null,
> +        					new Object[] {new
> Integer(m_rmi_registry_port)},
> +        					new String[] {"int"}
> +        					);
>          server.invoke( naming, "start", null, null );
>
>          // Create the JRMP adaptor
> @@ -256,6 +265,8 @@
>
>          mbean.putJNDIProperty(
> javax.naming.Context.INITIAL_CONTEXT_FACTORY,
>                                 m_namingFactory );
> +		mbean.putJNDIProperty(javax.naming.Context.PROVIDER_URL,
> "rmi://localhost:" + m_rmi_registry_port);
> +
>          // Register the JRMP adaptor in JNDI and start it
>          mbean.start();
>      }
>
> ---------------------
> - End patchfile.txt -
> ---------------------
>
>
>
> ********************************************************************
>       Visit our Internet site at http://www.rbsmarkets.com
>
> This e-mail is intended only for the addressee named above.
> As this e-mail may contain confidential or privileged information,
> if you are not the named addressee, you are not authorised to
> retain, read, copy or disseminate this message or any part of it.
> The Royal Bank of Scotland plc is registered in Scotland No 90312
> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB
> Regulated by the Financial Services Authority
> ********************************************************************

-- 
Cheers,

Peter Donald
*------------------------------------------------------*
| "The whole problem with the world is that fools and  |
| fanatics are always so certain of themselves, but    |
| wiser people so full of doubts." - Bertrand Russell  |
*------------------------------------------------------*


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org