com.ibm.di.api.remote.impl.rmi
Class RMISocketFactory

java.lang.Object
  extended by com.ibm.di.api.remote.impl.rmi.RMISocketFactory
All Implemented Interfaces:
Serializable, RMIClientSocketFactory, RMIServerSocketFactory

public class RMISocketFactory
extends Object
implements RMIServerSocketFactory, RMIClientSocketFactory, Serializable

A wrapper class of RMIServerSocketFactory class. Class used by the RMI to obtain server and client sockets for RMI calls. This Factory is running only on TDI Server side.

See Also:
Serialized Form

Constructor Summary
RMISocketFactory(Vector<String> aHosts)
          Constructor with two parameters.
RMISocketFactory(Vector<String> aHosts, BindAddressPolicy bindAddrPol)
          Constructor with two parameters.
 
Method Summary
static boolean allowConnection()
          Verifies access of the socket associated with the current thread to this RMISocketFactory.
 ServerSocket createServerSocket(int aPort)
          Create a server socket on the specified port.
 Socket createSocket(String host, int port)
          Create a client socket connected to the specified host and port.
protected static void setLocalThreadSocket(Socket aSocket)
          Sets the current thread's copy of this thread-local variable to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMISocketFactory

public RMISocketFactory(Vector<String> aHosts,
                        BindAddressPolicy bindAddrPol)
Constructor with two parameters.

Parameters:
aHosts - Vector object of provided hosts
bindAddrPol - Object where bind addresses are obtained from

RMISocketFactory

public RMISocketFactory(Vector<String> aHosts)
Constructor with two parameters.

Parameters:
aHosts - Vector object of provided hosts
bindAddrPol - Object where bind addresses are obtained from
Method Detail

createServerSocket

public ServerSocket createServerSocket(int aPort)
                                throws IOException
Create a server socket on the specified port. The Bind Address is set implicitly.

Specified by:
createServerSocket in interface RMIServerSocketFactory
Parameters:
aPort - the port. port 0 indicates an anonymous port
Returns:
the server socket on the specified port
Throws:
IOException - if I/O error occurs during server socket creation

createSocket

public 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
Parameters:
host - the host name
port - the port number
Returns:
a socket connected to the specified host and port
Throws:
IOException - if I/O error occurs during socket creation

setLocalThreadSocket

protected static void setLocalThreadSocket(Socket aSocket)
Sets the current thread's copy of this thread-local variable to the specified value. Many applications will have no need for this functionality, relying solely on the initialValue method to set the values of thread-locals.

Parameters:
aSocket - the value to be stored in the current threads' copy of this thread-local.

allowConnection

public static boolean allowConnection()
                               throws Exception
Verifies access of the socket associated with the current thread to this RMISocketFactory.

Returns:
true if the socket has access, otherwise returns false
Throws:
Exception - if no Socket is associated with the current thread