110 likes | 365 Views
RMI-IIOP and JNDI. Celsina Bignoli bignolic@smccd.net. Java RMI-IIOP. Java Remote Method Invocation over Internet Inter-ORB Protocol Mechanism that allows objects to communicate across a network Special version of RMI, compliant with CORBA Uses java.rmi and javax.rmi packages.
E N D
RMI-IIOPandJNDI Celsina Bignoli bignolic@smccd.net
Java RMI-IIOP • Java Remote Method Invocation over Internet Inter-ORB Protocol • Mechanism that allows objects to communicate across a network • Special version of RMI, compliant with CORBA • Uses java.rmi and javax.rmi packages
Remote Interface • separation between • Interface: exposes to the client what methods can be invoked on an object and what are their parameters • Implementation: the programming logic provided by the object • in RMI-IIOP, need to define a Remote Interface which extends java.rmi.Remote
Remote Object Implementation • Implements the remote interface • To allow remote clients to invoke its methods, must either • Extend javax.rmi.PortableRemoteObject • Be manually exported using javax.rmi.PortableRemoteObject. exportObject()
Location transparency • RMI-IIOP masks weather the object you are invoking is local or remote • Uses a stub to accept method calls locally and delegate those calls to the actual object implementation which might reside across the network • Uses a skeleton on the remote host to receive calls over the network and delegate the calls to the object implementation. • Stubs and skeletons are automatically generated by a tool, called rmic, provided as part of the Java RMI-IIOP implementation
Stubs and Skeletons Client Implementation Object Remote Interface Remote Interface Stub Skeleton Network
Object Serialization • Conversion of a Java object into a bit-blob representation • Must implement the java.lang.Serializable interface (marker interface, no methods) • Rules for member variables • All primitive types are serializable and will be serialized unless marked as transient • Objects marked as transient will not be serialized • Objects not marked as transient must be Serializable
RMI-IIOP and Object Serialization • Java RMI-IIOP uses serialization for passing parameters via remote method invocation. • A parameter is serialized and passed by-value • Java RMI-IIOP can also simulate pass-by-reference. • The parameter must be declared as a remote object • The stub for the remote object is serialized and passed by-value.