Java Platform 1.2
Beta 4

Class java.rmi.server.RMISocketFactory

java.lang.Object
  |
  +--java.rmi.server.RMISocketFactory

public abstract class RMISocketFactory
extends Object
implements RMIClientSocketFactory, RMIServerSocketFactory
An RMISocketFactory instance is used by the RMI runtime in order to obtain client and server sockets for RMI calls. An application may use the setSocketFactory method to request that the RMI runtime use its socket factory instance instead of the default implementation.

The default socket factory implementation used goes through a three-tiered approach to creating client sockets. First, a direct socket connection to the remote VM is attempted. If that fails (due to a firewall), the runtime uses HTTP with the explicit port number of the server. If the firewall does not allow this type of communication, then HTTP to a cgi-bin script on the server is used to POST the RMI call.

Since:
JDK1.1

Method Summary
abstract  ServerSocket createServerSocket(int port)
          Create a server socket on the specified port (port 0 indicates an anonymous port).
abstract  Socket createSocket(String host, int port)
          Create a client socket connected to the specified host and port.
static RMISocketFactory getDefaultSocketFactory()
          Returns a reference to the default socket factory used by this RMI implementation.
static RMIFailureHandler getFailureHandler()
          Returns the handler for socket creation failure.
static RMISocketFactory getSocketFactory()
          Returns the socket factory used by RMI.
static void setFailureHandler(RMIFailureHandler fh)
          Set the failure handler to be called by the RMI runtime if socket creation fails.
static void setSocketFactory(RMISocketFactory fac)
          Set the socket factory from which RMI gets sockets.
 
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

Method Detail

createSocket

public abstract Socket createSocket(String host,
                                    int port)
                             throws IOException
Create a client socket connected to the specified host and port.
Specified by:
createSocket in interface RMIClientSocketFactory

createServerSocket

public abstract ServerSocket createServerSocket(int port)
                                         throws IOException
Create a server socket on the specified port (port 0 indicates an anonymous port).
Specified by:
createServerSocket in interface RMIServerSocketFactory

setSocketFactory

public static void setSocketFactory(RMISocketFactory fac)
                             throws IOException
Set the socket factory from which RMI gets sockets. The RMI socket factory can only be set once. Note: The RMISocketFactory may only be set if the current security manager allows setting a socket factory; if disallowed, a SecurityException will be thrown.

getSocketFactory

public static RMISocketFactory getSocketFactory()
Returns the socket factory used by RMI.

getDefaultSocketFactory

public static RMISocketFactory getDefaultSocketFactory()
Returns a reference to the default socket factory used by this RMI implementation. This will be the factory used by the RMI runtime when getSocketFactory returns null.

setFailureHandler

public static void setFailureHandler(RMIFailureHandler fh)
Set the failure handler to be called by the RMI runtime if socket creation fails. The default implementation of this handler returns false (thus recreation of sockets is not attempted by the runtime).

getFailureHandler

public static RMIFailureHandler getFailureHandler()
Returns the handler for socket creation failure.

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.