Over the length is limited, so continue.
3. RMI-IIOP and JNDI integration:
l RMI-IIOP mainly wants to use JNDI to do two things:
n RMI-IIOP Server uses JNDI API to post itself to a JNDI tree; for example:
Generator o = new generator (); // This is a remote object
Javax.naming.context ctx = new javax.naming.initialcontext (system.getproperties ());
CTX.Rebind ("Obj", O);
SYNCHRONIZED (O) {
O. Wait ();
}
First initialize a remote object generator, then get the initial context, bind the remote object to the JNDI tree, and finally wait for the client call.
n The client finds the RMI-IIOP object through JNDI, for example:
Javax.naming.context ctx = new javax.naming.initialcontext (system.getproperties ());
Object RemoteObj = CTX.lookup ("obj");
GENERATOR G = (Generator) javax.naming.portableremoteObject.narrow (Remoteobj, Generator.class);
Here, a static method of the RMI-IIOP object PortableRemoteObject - Narrow (). The role of this method is to enforce objects to remote objects when looking for remote objects on the JNDI tree. Why don't you use common forced conversion methods? A short answer is: in order to be compatible with CORBA.