Configure multihome servers
This topic has not yet been written. The content below is from the topic description.
As of release 2.4, besides binding to all available interfaces, it is also possible to configure a server to bind to a subset of the interfaces available on a given host. Suppose, for example, that a host machine has NICs configured with addresses 10.32.4.2, 192.168.4.2, and 192.168.8.2, and suppose that 192.168.8.2 is on a LAN from which access is meant to be denied. It is now possible to create a single server that binds to 10.32.4.2 and 192.168.4.2. It would be convenient to be able to create an InvokerLocator that looks something like: socket://10.32.4.2&192.168.4.2:6500 but, unfortunately, that violates the URI syntax. Instead, a special placeholder, "multihome", is used in the host position, and the actual host addresses are given in the query component, e.g., socket://multihome/?homes=10.32.4.2:6500!192.168.4.2:6500 An abbreviated syntax allows factoring out the bind port: socket://multihome:6500/?homes=10.32.4.2!192.168.4.2 The value in the port position is treated as a default value which can be overriden in the "homes" parameter: socket://multihome:6500/?homes=10.32.4.2!192.168.4.2:6501 binds to 10.32.4.2:6500 and 192.168.4.2:6501. In the presence of a NAT router, it may be necessary for the client to connect to addresses different than the bind addresses, and a set of connect addresses may be specified with a "connecthomes" parameter: socket://multihome/?homes=10.32.4.2:6500!192.168.4.2:6501 &connecthomes=10.32.42.2:7500!192.168.42.2:7501 specifies a server that binds to 10.32.4.2:6500 and 192.168.4.2:6501, as before, but now a client connects to it using the addresses 10.32.42.2:7500 and 192.168.42.2:7501. Multihome servers may be configured, also, in *-service.xml MBean files and *-beans.xml POJO files. The following MBean definition is equivalent to the preceding locator: 10.32.4.2:6500 192.168.4.2:6501 10.32.42.2:7500 192.168.42.2:7501 ... The "serverBindPort" and "clientConnectPort" attributes may be used to give default values for bind ports and connect ports, respectively. The same server may be configured with the org.jboss.remoting.ServerInvocation object as well. For example, Connector connector = new Connector(); // Create ServerConfiguration object for socket transport ServerConfiguration serverConfig = new ServerConfiguration("socket"); // Add invokerLocatorParameters (applicable to client and server) Map locatorConfig = new HashMap(); locatorConfig.put("homes", "10.32.4.2:6500!192.168.4.2:6501"); locatorConfig.put("connecthomes", "10.32.42.2:7500!192.168.42.2:7501"); serverConfig.setInvokerLocatorParameters(locatorConfig); // Add invocation handlers ... connector.setServerConfiguration(serverConfig); connector.create(); connector.start(); is equivalent to the preceding MBean definition. Note. The Strings "homes" and "connecthomes" are available as constants in the InvokerLocator class: InvokerLocator.HOMES_KEY and InvokerLocator.CONNECT_HOMES_KEY.