Example usage for java.rmi.server RMIServerSocketFactory RMIServerSocketFactory

List of usage examples for java.rmi.server RMIServerSocketFactory RMIServerSocketFactory

Introduction

In this page you can find the example usage for java.rmi.server RMIServerSocketFactory RMIServerSocketFactory.

Prototype

RMIServerSocketFactory

Source Link

Usage

From source file:org.apache.jackrabbit.j2ee.RepositoryStartupServlet.java

/**
 * Returns an <code>RMIServerSocketFactory</code> used to create the server
 * socket for a locally created RMI registry.
 * <p>/*from   w  w w. j a  va  2 s .co m*/
 * This implementation returns a new instance of a simple
 * <code>RMIServerSocketFactory</code> which just creates instances of
 * the <code>java.net.ServerSocket</code> class bound to the given
 * <code>hostAddress</code>. Implementations may overwrite this method to
 * provide factory instances, which provide more elaborate server socket
 * creation, such as SSL server sockets.
 *
 * @param hostAddress The <code>InetAddress</code> instance representing the
 *                    the interface on the local host to which the server sockets are
 *                    bound.
 * @return A new instance of a simple <code>RMIServerSocketFactory</code>
 *         creating <code>java.net.ServerSocket</code> instances bound to
 *         the <code>rmiHost</code>.
 */
protected RMIServerSocketFactory getRMIServerSocketFactory(final InetAddress hostAddress) {
    return new RMIServerSocketFactory() {
        public ServerSocket createServerSocket(int port) throws IOException {
            return new ServerSocket(port, -1, hostAddress);
        }
    };
}

From source file:org.taverna.server.master.localworker.AbstractRemoteRunFactory.java

private Registry makeRegistry(int port) throws RemoteException {
    if (rmiLocalhostOnly) {
        setProperty("java.rmi.server.hostname", "127.0.0.1");
        return createRegistry(port, getDefaultSocketFactory(), new RMIServerSocketFactory() {
            @Override/* w w w.  ja  va  2  s  . c o  m*/
            public ServerSocket createServerSocket(int port) throws IOException {
                return new ServerSocket(port, 0, getLocalHost());
            }
        });
    } else {
        return createRegistry(port);
    }
}