org.jboss.remoting.transport.rmi
Class RemotingRMIClientSocketFactory

java.lang.Object
  extended by org.jboss.remoting.transport.rmi.RemotingRMIClientSocketFactory
All Implemented Interfaces:
java.io.Serializable, java.rmi.server.RMIClientSocketFactory
Direct Known Subclasses:
SerializableSSLClientSocketFactory

public class RemotingRMIClientSocketFactory
extends java.lang.Object
implements java.rmi.server.RMIClientSocketFactory, java.io.Serializable

RemotingRMIClientSocketFactory provides two services to RMIServerInvoker.

  1. It can be parameterized by a host name, allowing RMIServerInvoker to supply RMI with a factory which creates sockets connected to a specified host name.

  2. It can be parameterized by a SocketFactory allowing RMIServerInvoker to supply RMI with a factory facility which creates specialized sockets.

if the SocketFactory parameter is specified, then the RemotingRMIClientSocketFactory should be used with a matching instance of RemotingRMIServerSocketFactory with a compatible ServerSocketFactory.

If the SocketFactory parameter is not specified, an instance of java.net.Socket will be created by default.

Although there is no apparent need for the host name parameter, since the createSocket() method receives a host name, it seems that for a server object bound to localhost, the RMI runtime will pass to createSocket() one of the IP addresses for which the host is configured (other than 127.0.0.1), resulting in a failure to retrieve the object from the Registry. If a host name is passed to a RemotingRMIClientFactory constructor, it will override the host name passed to createSocket() In particular, parameterizing RemotingRMIClientSocketFactory with localhost will allow the retrieval of objects bound to localhost.

Version:
$Revision: 2389 $

Copyright (c) 2005

Author:
Ron Sigal
See Also:
Serialized Form

Nested Class Summary
protected static class RemotingRMIClientSocketFactory.ComparableHolder
           
 
Field Summary
protected static java.util.HashMap configMaps
           
protected  java.util.Map configuration
           
protected  java.lang.String hostName
           
protected  InvokerLocator invokerLocator
           
protected static org.jboss.logging.Logger log
           
protected static java.util.Map socketFactories
           
protected  javax.net.SocketFactory socketFactory
           
 
Constructor Summary
RemotingRMIClientSocketFactory(InvokerLocator locator, java.lang.String hostName, int timeout, java.util.Map config)
           
 
Method Summary
static void addLocalConfiguration(InvokerLocator invokerLocator, java.util.Map localConfig)
           
 java.net.Socket createSocket(java.lang.String host, int port)
          Creates a new socket.
 javax.net.SocketFactory retrieveSocketFactory(RemotingRMIClientSocketFactory.ComparableHolder holder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.jboss.logging.Logger log

configMaps

protected static java.util.HashMap configMaps

socketFactories

protected static java.util.Map socketFactories

configuration

protected java.util.Map configuration

invokerLocator

protected InvokerLocator invokerLocator

socketFactory

protected transient javax.net.SocketFactory socketFactory

hostName

protected java.lang.String hostName
Constructor Detail

RemotingRMIClientSocketFactory

public RemotingRMIClientSocketFactory(InvokerLocator locator,
                                      java.lang.String hostName,
                                      int timeout,
                                      java.util.Map config)
Parameters:
locator -
hostName -
timeout -
config -
Method Detail

addLocalConfiguration

public static void addLocalConfiguration(InvokerLocator invokerLocator,
                                         java.util.Map localConfig)

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException
Creates a new socket. If a SocketFactory was passed to the constructor, it will be used. Otherwise, a java.net.Socket will be created by default.

Specified by:
createSocket in interface java.rmi.server.RMIClientSocketFactory
Parameters:
host - host to which socket should be connected
port - port to which socket should be connected
Returns:
new socket
Throws:
java.io.IOException - if there is a problem creating a socket

retrieveSocketFactory

public javax.net.SocketFactory retrieveSocketFactory(RemotingRMIClientSocketFactory.ComparableHolder holder)
                                              throws java.io.IOException
Throws:
java.io.IOException


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.