3 Replies Latest reply on Apr 25, 2006 3:23 PM by tom.elrod

    PooledInvokerProxy proposition

    olegnitz

      Hi All!

      I have encountered a problem with the current way of opening connection by PooledInvokerProxy - server supplies its host name as server address - the problem is that some client can't resolve the host name. Sometimes client's DNS is set up incorrectly, sometimes everything happens in the local network where there are no real Internet host names and people set names to their machines as they like. In these cases we just set java.naming.provider.url in jndi.properties to the IP address of server and everything worked fine until we changed jrmp invoker to pooled invoker. The first my idea was that server should return its IP address instead of host name, and I've proposed this via JIRA, but Adrian Brock pointed out that this won't work if server is in a local network behind firewall.
      Now I come out with another proposition: don't get server address from server! Client already knows server address from jndi properties, let's use it! I think this would also work in the complex case where the server has two different IP addresses for two local networks and clients from these networks should address the server differently. I have already implemented this solution and it works. The code looks like

      serverAddr = (new InitialContext()).getEnvironment().get(InitialContext.PROVIDER_URL)

      followed by some parsing in order to strip away protocol and port from the URL. I will submit this code to JIRA if this solution is accepted.

      Waiting for your comments,
      Oleg Nitz

        • 1. Re: PooledInvokerProxy proposition
          starksm64

          This would have to be a configurable behavior. We have notions of treating the proxy address as a system property in the http invoker. Using the server portion of the JNDI provider url is yet another policy. Perhaps the most extensible solution is to provide an option address resolution plugin

          public interface AddressResolver
          {
           public InetAddress resolveAddress(String address);
          }
          


          This could be configured on the server, overriden on the client or configured via client settings (such as the JNDI provider url host) based on the implementation of the resolver.


          • 2. Re: PooledInvokerProxy proposition
            olegnitz

            It's a possible solution.
            However I think that having different behavior of http invoker and pooled invoker is natural and doesn't mean that we need some uniform solution.

            • 3. Re: PooledInvokerProxy proposition

              Think the idea of having a address resolver is good. Only problem I see is how is a user going to be able to alter this during runtime on the client? Like in the case of ejb client proxy, there are no hooks to do this.