JBoss.org Community Documentation

2.2.3. JBoss configuration

The cluster-service.xml file in the all/deploy directory includes the following MBean to enable HA-JNDI services.

<mbean code="org.jboss.ha.jndi.HANamingService"            
name="jboss:service=HAJNDI">       
<depends optional-attribute-name="ClusterPartition" 
proxy-type="attribute">jboss:service=${jboss.partition.name:DefaultPartition}</depends> 
       
<mbean>

You can see that this MBean depends on the DefaultPartition MBean defined above it (discussed earlier in this chapter). In other configurations, you can put that element in the jboss-service.xml file or any other JBoss configuration files in the /deploy directory to enable HA-JNDI services. The available attributes for this MBean are listed below.

  • Cluster Partition is a required attribute to inject the HAPartition service that HA-JNDI uses for intra-cluster communication.

  • BindAddress is an optional attribute to specify the address to which the HA-JNDI server will bind waiting for JNP clients. Only useful for multi-homed computers. The default value is the value of the jboss.bind.address system property, or the host's default addresss if that property is not set. The jboss.bind.address system property is set if the -b command line switch is used when JBoss is started.

  • Port is an optional attribute to specify the port to which the HA-JNDI server will bind waiting for JNP clients. The default value is 1100.

  • Backlog is an optional attribute to specify the backlog value used for the TCP server socket waiting for JNP clients. The default value is 50.

  • RmiPort determines which port the server should use to communicate with the downloaded stub. This attribute is optional. The default value is 1101. If no value is set, the server automatically assigns a RMI port.

  • DiscoveryDisabled is a boolean flag that disables configuration of the auto discovery multicast listener.

  • AutoDiscoveryAddress is an optional attribute to specify the multicast address to listen to for JNDI automatic discovery. The default value is the value of the jboss.partition.udpGroup system property, or 230.0.0.4 if that is not set. The jboss.partition.udpGroup system property is set if the -u command line switch is used when JBoss is started.

  • AutoDiscoveryGroup is an optional attribute to specify the multicast group to listen to for JNDI automatic discovery.. The default value is 1102.

  • AutoDiscoveryBindAddress sets the interface on which HA-JNDI should listen for auto-discovery request packets. If this attribute is not specified and a BindAddress is specified, the BindAddress will be used..

  • AutoDiscoveryTTL specifies the TTL (time-to-live) for autodiscovery IP multicast packets. This value represents the number of network hops a multicast packet can be allowed to propagate before networking equipment should drop the packet. Despite its name, it does not represent a unit of time.

  • LoadBalancePolicy specifies the class name of the LoadBalancePolicyimplementation that should be included in the client proxy. See the earlier section on “Load-Balancing Policies” for details.

  • LookupPool specifies the thread pool service used to control the bootstrap and auto discovery lookups.

The full default configuration of the HANamingService MBean is as follows.

 <mbean code="org.jboss.ha.jndi.HANamingService" 
	name="jboss:service=HAJNDI"> 
	 <!-- We now inject the partition into the HAJNDI service instead 
	 of requiring that the partition name be passed --> 
	 <depends optional-attribute-name="ClusterPartition" 
	 proxy-type="attribute">jboss:service=${jboss.partition.name:DefaultPartition}</depends> 
	 <!-- Bind address of bootstrap and HA-JNDI RMI endpoints --> 
	 <attribute name="BindAddress">${jboss.bind.address}</attribute> 
	 <!-- Port on which the HA-JNDI stub is made available --> 
	 <attribute name="Port">1100</attribute> 
	 <!-- RmiPort to be used by the HA-JNDI service once bound. 0 => auto. --> 
	 <attribute name="RmiPort">1101</attribute> 
	 <!-- Accept backlog of the bootstrap socket --> 
	 <attribute name="Backlog">50</attribute> 
	 <!-- The thread pool service used to control the bootstrap and auto discovery lookups --> 
	<depends optional-attribute-name="LookupPool" 
	 proxy-type="attribute">jboss.system:service=ThreadPool</depends> 
	 <!-- A flag to disable the auto discovery via multicast --> 
	<attribute name="DiscoveryDisabled">false</attribute> 
	<!-- Set the auto-discovery bootstrap multicast bind address. If not 
	 specified and a BindAddress is specified, the BindAddress will be used. --> 
	 <attribute name="AutoDiscoveryBindAddress">${jboss.bind.address}</attribute> 
	 <!-- Multicast Address and group port used for auto-discovery --> 
	 <attribute name="AutoDiscoveryAddress">${jboss.partition.udpGroup:230.0.0.4}</attribute> 
	 <attribute name="AutoDiscoveryGroup">1102</attribute> 
	 <!-- The TTL (time-to-live) for autodiscovery IP multicast packets --> 
	 <attribute name="AutoDiscoveryTTL">16</attribute> 
	 <!-- The load balancing policy for HA-JNDI --> 
	 <attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.RoundRobin</attribute> 
	
	 <!-- Client socket factory to be used for client-server 
	 RMI invocations during JNDI queries 
	 <attribute name="ClientSocketFactory">custom</attribute> 
	 --> 
	 <!-- Server socket factory to be used for client-server 
	 RMI invocations during JNDI queries 
	 <attribute name="ServerSocketFactory">custom</attribute> 
	  --> 
   </mbean>

It is possible to start several HA-JNDI services that use different clusters. This can be used, for example, if a node is part of many clusters. In this case, make sure that you set a different port or IP address for eachservices. For instance, if you wanted to hook up HA-JNDI to the example cluster you set up and change the binding port, the Mbean descriptor would look as follows.

<mbean code="org.jboss.ha.jndi.HANamingService"    
      name="jboss:service=HAJNDI">    

      <depends optional-attribute-name="ClusterPartition" 
   proxy-type="attribute">jboss:service=MySpecialPartition</depends>  
 <attribute name="Port">56789</attribute>  
</mbean>