< Day Day Up > |
In RMI, an object residing on a server machine may be manipulated by another object residing on a remote client machine. The terms client and server here apply only for this single call, because in a later transaction, the machine that acted as the server can also act as a client and request an RMI from another machine, which would be the server for this new interaction. When it wants to invoke a remote method, a client object calls a Java method that is encapsulated in a surrogate object called the stub . The stub resides on the same machine as the client. The stub then uses the Java object serialization mechanism to send data in a format suitable for transporting the parameters and the method call to a process on the server. The stub builds an information block that consists of
This information block is sent to the server. A skeleton object residing at the server end receives this information block and takes the appropriate actions:
Now, the stub receives the response from the skeleton and unmarshals the return value or the Exception s. The stub is also responsible for passing the return value or the Exception to the process that called the stub initially. Starting with Java 2 SDK, Standard Edition, V1.2, an additional stub protocol has been introduced that eliminates the need for skeletons in environments that involve the Java 2 SDK platform only. Instead, generic code is used to carry out the duties performed by skeletons in the JDK V1.1. |
< Day Day Up > |