First of all I want to say hello to everyone (so - Hello!!
). This is my first post on this forum and it`s actually my first Java related forum that I registered in ever. I hope to spend some quality time over here. ;) I have a tendency to write very long first post in a topic so I hope you will manage to get to the end but back to the topic.
Currently I`m writing my engineer thesis and I`ve been reading for the last few days about RMI-IIOP architecture which I need to discuss. I have opened a tens of tabs in my Firefox and there I have a whole bunch of articles and specifications. I feel like my brain can blow up at any time. I hope you can help me to resolve my deep doubts about RMI-IIOP.
It would be great if you could answer at least one my question. Please confirm if my way of thinking is correct.
An example of creation process of RMI-IIOP client and server side:
Server side
1) Creating a so called remote interface which extends javax.rmi.Remote interface all methods must throw a java.rmi.RemoteException.
2) Creating a class of our remote object which implements our remote interface.
3) Creating a stub and tie of remote object.
4) Running an Object Request Broker (orbd.exe) which will also run COS Naming Service.
5)
Registering of remote object:
a] by using javax.rmi.PortableRemoteObject exportObject() method,
b] by extending PortableRemoteObject by it (then a creation of remote object will effect in invoking of PortableRemoteObject constructor where will be invoked exportObject() method).
6) Configuring JNDI by jndi.properties file or by passing right arguments (java.naming.factory.initial and java.naming.provider.url parameters - the provider url need to be the same as ORB ip adress and port) to the javax.naming.InitialContext constructor to handle the COS Naming Service.
7) Binding the remote object reference with picked name by calling the InitialContext bind() or rebind() method.
Client side
8) Providing to the client the remote interface of our remote object.
9) Configuring JNDI by
the same as on the server side jndi.properties file or right arguments in InitialContext constructor.
10) Connecting with remote object by invoking the InitialContext lookup() method with argument which has to be the name of our remote server object.
11) Casting obtained reference to remote interface using PortableRemoteObject narrow() method.
Hopefully that's all.
That was a quite brief introduction to RMI-IIOP implementation and here are
my questions:
1] Didn't I omit anything important in my example of creation process? I`m only checking...
2] I read that "somewhere" in RMI-IIOM results are passed by reference instead of by value? Where is it and how come? If I recall correctly Java is a strictly pass by value language, am I right?
3] I haven't checked it yet. Is it possible to create a stub and tie from remote interface instead of remote object and is it going to work?
4] I'm wondering is it abligatory to create a stub and tie class before registering/exporting the remote object?
5] What do we mean by registering the remote object?
6] The specification says exportObject() method "Makes a server object ready to receive remote calls" I understand that's some thought abbreviation? How object can receive remote calls...? (I guess it has something in common with ORB but that?)
7] I read somewhere that by invoking InitialContext bind() or rebind() method we actually don`t bind name to the remote object reference but to the stub of this object and somewhere else I read that we bind the remote object reference with the name but client looking up for the name receive reference to its stub so where the truth lies?
8] I need to confirm something. I'm sure that looking up for the remote object returns the stub object but I didn't provide the stub class to the client so how is that possible that I didn't received some exception like No Class Definition Found Exception (of course I casted it to some other type like object or remote interface type)? I also read that client need to have a stub class so...? That's really confusing.
9] I quite don't get one thing (or rather another thing). I read (yeah I know, I had a lot of reading lately ;)) that marshalling and unmarshalling is done by stub and tie in the other source I read that it's provided by ORB so how it really looks like?
10] How the communication between client and server looks? It's that correct that stub "speaks to" tie and tie invokes the method on remote object? How tie obtains the remote object reference and where is the place for ORB in this communication?
11] Client communicates with server by IIOP so I guess there is an implementation of IOR in Java and this is how a client can localize a server, am I right? Am I correct that stub and tie stores the information about localization of each other? If that's true then when exactly stub obtains this information?
12] Is that true that ORB provides persistence to remote objects? So if the server is offline remote object is still alive and can receive the RMI calls?
13] I know that COS Naming bind remote object reference with name and this service is launched on the same port as ORB (that`s correct, isn`t it?) but I also read that remote objects are exported to some ports so what does it mean?
Okey now I'm sure that my brain is going to blow up, hehe. This is my the longest post in English ever (sorry for probably a lot of language mistakes) and there is a high possibility I forgot to write about some other stuff that I don't know or I'm not sure about. Thank you very much for your patient and, I hope, your help.