wt.boot
Class WTRMIMasterSocketFactory
java.lang.Object
java.rmi.server.RMISocketFactory
wt.boot.WTRMIMasterSocketFactory
- All Implemented Interfaces:
- RMIClientSocketFactory, RMIServerSocketFactory, Serializable
- public class WTRMIMasterSocketFactory
- extends RMISocketFactory
- implements Serializable
A Master RMI socket factory that improves on the JDK default connection failover logic.
This factory includes support for HTTP and HTTPS regardless of system properties, and uses
asynchronous connection attempts for all alternate socket factories to reduce total connection time.
It first starts a direct socket connection. If that fails or does not complete in 10 seconds,
it starts a HTTP URL connection to the target port in case the client is behide a HTTP proxy
server. If that fails or does not complete in 10 seconds, it simultaneously starts HTTP and
(optionally) HTTPS URL connections to the Java RMI CGI gateway (/cgi-bin/java-rmi.cgi). The first
connection of any of these four to complete sucessfully is used and the resulting socket factory
will be reused for all subsequent connections to that host.
This differs from the default JDK implementation which aborts the direct connection after 15
seconds, only tries HTTP if http.proxyHost or httpProxy System properties are set, has no
support for HTTPS. The JDK version tries HTTP to port followed by HTTP to CGI sequentially with
no timeout, each of which may take 45 seconds or more to fail. This would result in close to 2
minute delays before reaching via HTTPS if it did support it. This new class was created
to make the RMI to HTTP failover logic usable in the real world. It responds to the following
system properties for configuration:
Property |
Description |
java.rmi.server.disableHttp |
If set to true, disables the use of HTTP for RMI calls. This means that RMI will never
resort to using HTTP or HTTPS URL connections to invoke a call through a HTTP proxy server
or firewall. Defaults to false (HTTP usage is enabled). This property is the same one used by
the JDK's default master socket factory. |
sun.rmi.transport.proxy.connectTimeout |
Milliseconds to wait for a connection to complete when trying to contact a remote
host. Default is 15000 (15 seconds). This property is the same one used by the JDK's default
master socket factory. |
sun.rmi.transport.proxy.logLevel |
If set to a value greater than or equal to 10, messages will be written to the standard
RMI log regarding socket factory selection and usage. This property is the same one used by
the JDK's default master socket factory. |
wt.boot.enableHttps |
If set to true, enables the use of HTTPS (secure connections) for RMI calls. Defaults
to false (only HTTP usage is enabled). The windchill bootstrap loader sets this property
if it encounters a HTTPS codebase URL. |
wt.boot.failoverTimeout |
Milliseconds to wait for a connection to complete before proceeding to start the next
alternate type of connection. Default is 5000 (5 seconds). The windchill boostrap loader
sets this property to the value of its own failoverTimeout property |
wt.boot.socketFactory |
Explicitly specifies desired socket factory class. |
wt.boot.socketFactory. |
Explicitly specifies desired socket factory class for a given host. |
Supported API: false
Extendable: false
- See Also:
- Serialized Form
Method Summary |
private AsyncConnector |
checkConnectors(int index,
AsyncConnector[] connectors,
long timeout)
|
private static boolean |
checkForJ2Security()
|
private AsyncConnector |
checkSuccess(int index,
AsyncConnector[] connectors)
|
ServerSocket |
createServerSocket(int port)
Supported API: false |
Socket |
createSocket(String host,
int port)
Supported API: false |
boolean |
equals(Object obj)
|
private static RMISocketFactory |
getDirectSocketFactory()
|
private static RMISocketFactory |
getFactory(String factoryName)
|
private static RMISocketFactory |
getHttpsToCGISocketFactory()
|
private static RMISocketFactory |
getHttpToCGISocketFactory()
|
private static RMISocketFactory |
getHttpToCodebaseSocketFactory()
|
private static RMISocketFactory |
getHttpToPortSocketFactory()
|
private static String |
getProperty(String name)
|
private static String |
getProperty(String name,
String def)
|
private static String |
getPropertyJ2(String name,
String def)
|
private static RMISocketFactory |
getServerSocketFactory()
|
private boolean |
startConnector(int index,
AsyncConnector[] connectors,
RMISocketFactory factory,
String host,
int port)
|
JAVA2_SECURITY
private static final boolean JAVA2_SECURITY
systemProperties
private static transient Properties systemProperties
directSocketFactory
private static transient RMISocketFactory directSocketFactory
httpToPortSocketFactory
private static transient RMISocketFactory httpToPortSocketFactory
httpToCGISocketFactory
private static transient RMISocketFactory httpToCGISocketFactory
httpsToCGISocketFactory
private static transient RMISocketFactory httpsToCGISocketFactory
serverSocketFactory
private static transient RMISocketFactory serverSocketFactory
disableHttp
private static transient boolean disableHttp
enableHttps
private static transient boolean enableHttps
factoryTable
private static transient Hashtable factoryTable
hostVector
private static transient Vector hostVector
connectTimeout
private static transient long connectTimeout
failoverTimeout
private static transient long failoverTimeout
logLevel
static transient int logLevel
codebase
static transient String codebase
WTRMIMasterSocketFactory
public WTRMIMasterSocketFactory()
- Supported API: false
checkForJ2Security
private static boolean checkForJ2Security()
equals
public boolean equals(Object obj)
createSocket
public Socket createSocket(String host,
int port)
throws IOException
- Supported API: false
- Specified by:
createSocket
in interface RMIClientSocketFactory
- Throws:
IOException
startConnector
private boolean startConnector(int index,
AsyncConnector[] connectors,
RMISocketFactory factory,
String host,
int port)
checkConnectors
private AsyncConnector checkConnectors(int index,
AsyncConnector[] connectors,
long timeout)
throws IOException
- Throws:
IOException
checkSuccess
private AsyncConnector checkSuccess(int index,
AsyncConnector[] connectors)
throws IOException
- Throws:
IOException
getFactory
private static RMISocketFactory getFactory(String factoryName)
getDirectSocketFactory
private static RMISocketFactory getDirectSocketFactory()
getHttpToPortSocketFactory
private static RMISocketFactory getHttpToPortSocketFactory()
getHttpToCGISocketFactory
private static RMISocketFactory getHttpToCGISocketFactory()
getHttpsToCGISocketFactory
private static RMISocketFactory getHttpsToCGISocketFactory()
getHttpToCodebaseSocketFactory
private static RMISocketFactory getHttpToCodebaseSocketFactory()
throws IOException
- Throws:
IOException
getServerSocketFactory
private static RMISocketFactory getServerSocketFactory()
createServerSocket
public ServerSocket createServerSocket(int port)
throws IOException
- Supported API: false
- Specified by:
createServerSocket
in interface RMIServerSocketFactory
- Throws:
IOException
getProperty
private static String getProperty(String name)
getProperty
private static String getProperty(String name,
String def)
getPropertyJ2
private static String getPropertyJ2(String name,
String def)