Example - using non-string values in InvokerLocator
One limitation of the InvokerLocator is that it can only represent string values. An alternative that overcomes this limitation is to pass some or all of the parameters to the Connector by way of a configuration map. The following code fragment accomplishes all that the previous fragment does, but it passes one parameter by way of the InvokerLocator and passes the other by way of a configuration map. It also passes in a non-string object, a ServerSocketFactory: String locatorURI = "socket://test.somedomain.com:8084"; String params = "/?clientLeasePeriod=10000"; locatorURI += params; InvokerLocator locator = new InvokerLocator(locatorURI); HashMap config = new HashMap(); config.put(ServerInvoker.TIMEOUT, "120000"); config.put(ServerInvoker.SERVER_SOCKET_FACTORY, new MyServerSocketFactory()); Connector connector = new Connector(locator, config); connector.create(); SampleInvocationHandler invocationHandler = new SampleInvocationHandler(); connector.addInvocationHandler("sample", invocationHandler); connector.start(); Note that the value of ServerInvoker.TIMEOUT is "timeout", and the value of ServerInvoker.SERVER_SOCKET_FACTORY is "serverSocketFactory". These configuration map keys are discussed throughout the chapter and accumulated in section Configuration by properties. Also, server socket factory configuration is covered in Socket factories and server socket factories.