Example - Injecting a POJO
A fifth option, which exists primarily to support the injection of POJOs in the presence of the JBoss Microcontainer, is to pass an org.jboss.remoting.ServerConfiguration object to the Connector.setServerConfiguration() method. The following fragment duplicates the behavior of the first and second examples above. HashMap config = new HashMap(); config.put(ServerInvoker.TIMEOUT, "120000"); Connector connector = new Connector(config); // Create ServerConfiguration object for socket transport ServerConfiguration serverConfig = new ServerConfiguration("socket"); // Add invokerLocatorParameters (applicable to client and server) Map locatorConfig = new HashMap(); locatorConfig.put("serverBindAddress", "test.somedomain.com"); locatorConfig.put("serverBindPort", "8084"); serverConfig.setInvokerLocatorParameters(locatorConfig); // Add serverParameters (applicable to server) Map serverParameters = new HashMap(); locatorConfig.put("clientLeasePeriod", "10000"); serverConfig.setServerParameters(serverParameters); // Add invocation handlers Map handlers = new HashMap(); handlers.put("mock", "org.jboss.remoting.transport.mock.SampleInvocationHandler"); serverConfig.setInvocationHandlers(handlers); connector.setServerConfiguration(serverConfig); connector.create(); connector.start();