|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
wt.util.RMIServer
A version of UnicastRemoteObject that allows on-the-fly configuration of the port number on which objects are exported, the host name used by clients when connecting, and object identifier (oid). Port number is set statically for all instances of RMIServer subclasses in a single JVM. Hostname and oid can be set per instance.
Control of hostname and oid allows building RMI server objects that can work in load balanced server clusters.
Field Summary | |
private static RMIClientSocketFactory |
CLIENT_SOCKET_FACTORY
|
private static Method |
CREATE_PROXY_METHOD
|
RMIClientSocketFactory |
csf
|
private boolean |
exported
|
private String |
hostname
|
private static InetAddress[] |
localAddrs
|
private static String |
localName
|
private RemoteStub |
marshalStub
|
private int |
oid
|
private static int |
port
|
private static Class |
REMOTE_PROXY_CLASS
|
private static String |
RESOURCE
|
private static InetAddress[] |
rmiAddrs
|
private static RMIServerSocketFactory |
SERVER_SOCKET_FACTORY
|
RMIServerSocketFactory |
ssf
|
private RemoteStub |
stub
|
private static Class |
SUN_RMI_UTIL_CLASS
|
Fields inherited from class java.rmi.server.RemoteServer |
|
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Constructor Summary | |
protected |
RMIServer()
|
protected |
RMIServer(int oid)
|
protected |
RMIServer(String hostname)
|
protected |
RMIServer(String hostname,
int oid)
|
protected |
RMIServer(String hostname,
int oid,
boolean export)
|
protected |
RMIServer(String hostname,
int oid,
boolean export,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
|
Method Summary | |
Object |
clone()
Returns a clone of the remote object that is distinct from the original. |
private static RemoteStub |
createProxy(String remote_classname,
Class stub_class,
sun.rmi.transport.LiveRef live_ref)
|
static RemoteStub |
exportObject(Remote obj)
Export the remote object to make it available to receive incoming calls. |
static RemoteStub |
exportObject(Remote obj,
String hostname,
int oid)
Export the remote object to make it available to receive incoming calls. |
static RemoteStub |
exportObject(Remote obj,
String hostname,
int oid,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
Export the remote object to make it available to receive incoming calls. |
private static Class |
getClassForName(String className,
boolean failQuietly)
|
static RMIClientSocketFactory |
getClientSocketFactory()
|
private static Method |
getMethod(Class cls,
String methodName,
Class[] argTypes,
boolean failQuietly)
|
static int |
getPort()
Get port number on which RMIServer objects are exported. |
static RMIServerSocketFactory |
getServerSocketFactory()
|
RemoteStub |
getStub()
Get remote stub from exporting of this server object. |
static boolean |
isHostInList(String host,
String list)
Utility method to check if a given host is in a list of host names. |
static boolean |
isLocalHost(String host)
Utility method to check if a given host is the local host. |
private void |
readObject(ObjectInputStream in)
Re-export the remote object when it is deserialized. |
private void |
reexport()
|
static void |
setPort(int port)
Set port number on which RMIServer objects are exported. |
Object |
writeReplace()
|
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static RMIClientSocketFactory CLIENT_SOCKET_FACTORY
private static RMIServerSocketFactory SERVER_SOCKET_FACTORY
private static int port
private String hostname
private int oid
public RMIClientSocketFactory csf
public RMIServerSocketFactory ssf
private RemoteStub stub
private RemoteStub marshalStub
private boolean exported
private static final Class REMOTE_PROXY_CLASS
private static final Class SUN_RMI_UTIL_CLASS
private static final Method CREATE_PROXY_METHOD
private static String localName
private static InetAddress[] localAddrs
private static InetAddress[] rmiAddrs
Constructor Detail |
protected RMIServer() throws RemoteException
protected RMIServer(String hostname) throws RemoteException
protected RMIServer(int oid) throws RemoteException
protected RMIServer(String hostname, int oid) throws RemoteException
protected RMIServer(String hostname, int oid, boolean export) throws RemoteException
protected RMIServer(String hostname, int oid, boolean export, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException
Method Detail |
public static RMIClientSocketFactory getClientSocketFactory()
public static RMIServerSocketFactory getServerSocketFactory()
public static void setPort(int port)
port
- the port number (0 = anonymous port)public static int getPort()
public RemoteStub getStub()
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public Object clone() throws CloneNotSupportedException
CloneNotSupportedException
- if clone failed due to
a RemoteException.private void reexport() throws RemoteException
RemoteException
public static RemoteStub exportObject(Remote obj) throws RemoteException
obj
- the remote object to be exported
RemoteException
- if export failspublic static RemoteStub exportObject(Remote obj, String hostname, int oid) throws RemoteException
obj
- the remote object to be exportedhostname
- the host name to include in remote stubs for this object (null = default)
RemoteException
- if export failspublic static RemoteStub exportObject(Remote obj, String hostname, int oid, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException
obj
- the remote object to be exportedhostname
- the host name to include in remote stubs for this object (null = default)oid
- the well known object identifier (0 = unique)csf
- the client-side socket factory for making calls to the remote object (null = default)ssf
- the server-side socket factory for receiving remote calls (null = default)
RemoteException
- if export failsprivate static Class getClassForName(String className, boolean failQuietly)
private static Method getMethod(Class cls, String methodName, Class[] argTypes, boolean failQuietly)
private static RemoteStub createProxy(String remote_classname, Class stub_class, sun.rmi.transport.LiveRef live_ref)
public Object writeReplace()
public static boolean isLocalHost(String host) throws IOException
java.rmi.server.hostname
property
to allow servers to be configured using virtual IP addresses.
Caller should cache result to avoid further name server lookups.
host
- the host name to check
IOException
public static boolean isHostInList(String host, String list) throws IOException
host
- the host name to check
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |