7.4. Code Generation in RMI

Java Remote Method Invocation (RMI) uses code generation to build stubs and skeletons. A stub implements a remote interface by serializing method calls into a stream and forwarding that stream to the actual implementation class, often on a different physical machine. RMI clients never hold a direct reference to an implementation class; instead they use a local stub class, which forwards the call to the implementation. A skeleton receives stream-encoded method calls from a stub, converts them back into call stacks, and invokes the corresponding methods. Figure 7-3 shows an RMI call passing through a stub and skeleton to the implementation class.

Figure 7-3. RMI calls pass through stubs.

To create RMI stubs and skeletons, ...

Get Component Development for the Java™ Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.