org.mbari.siam.utils.isiam
Class SiamShellSocketFactory

java.lang.Object
  extended by java.rmi.server.RMISocketFactory
      extended by org.mbari.siam.utils.isiam.SiamShellSocketFactory
All Implemented Interfaces:
java.rmi.server.RMIClientSocketFactory, java.rmi.server.RMIServerSocketFactory

public class SiamShellSocketFactory
extends java.rmi.server.RMISocketFactory

Intends to circumvent the limitation in NodeUtility.run in terms of allowing multiple execution of the utilities within the same JVM session.

Note that NodeUtility#run() calls RMISocketFactory.setSocketFactory, however, "The RMI socket factory can only be set once," so, it is not suited to support multiple execution of the utilities. The behavior is that only the first call to that method will be effective, and subsequent calls will fail, so, for example, a different serverHost is not possible.

The implementation here is adapted from SiamSocketFactory (the one used in NodeUtility#run()), but with the following changes:

Note: it is assumed (and this is the case currently) that the call in NodeUtility#run() to set the rmi registry will simply fail (because we set that first!) but that it will continue with the remaining of the command execution.

Author:
carueda

Method Summary
 java.net.ServerSocket createServerSocket(int port)
           
 java.net.Socket createSocket(java.lang.String host, int port)
           
 
Methods inherited from class java.rmi.server.RMISocketFactory
getDefaultSocketFactory, getFailureHandler, getSocketFactory, setFailureHandler, setSocketFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createServerSocket

public java.net.ServerSocket createServerSocket(int port)
                                         throws java.io.IOException
Specified by:
createServerSocket in interface java.rmi.server.RMIServerSocketFactory
Specified by:
createServerSocket in class java.rmi.server.RMISocketFactory
Throws:
java.io.IOException

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException
Specified by:
createSocket in interface java.rmi.server.RMIClientSocketFactory
Specified by:
createSocket in class java.rmi.server.RMISocketFactory
Throws:
java.io.IOException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.