Skip to Content
Head First Servlets and JSP, 2nd Edition
book

Head First Servlets and JSP, 2nd Edition

by Bryan Basham, Kathy Sierra, Bert Bates
March 2008
Intermediate to advanced
911 pages
20h 31m
English
O'Reilly Media, Inc.
Content preview from Head First Servlets and JSP, 2nd Edition

RMI makes life easy

You want your objects to communicate across a network. In other words, you want an object in one JVM to cause a method invocation on a remote object (i.e. an object in a different JVM), but you want to pretend that you’re invoking a method on a local object. That’s what RMI gives you—the ability to pretend (almost) that you’re making a regular old local method call.

What we want...

image with no caption

How RMI pulls it off

Let’s say your “business guy” hat is on, and you want to make an object available to remote clients. Using RMI, you’ll create a proxy and you’ll register your object with some sort of registry. Any client who wants to call your methods will do a lookup on the registry and get a copy of the remote proxy. Then the client will make calls on the remote proxy, pretending it’s the real thing. The remote proxy (called a stub), handles all the communications details like sockets, I/O streams, TCP/IP, serializing and deserializing method arguments and return values, handling exceptions, and so forth.

(Oh, by the way, there’s usually a proxy on the server side (often called a “skeleton”), doing similar chores on the server side where the remote object lives.)

image with no caption
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Head First Java, 2nd Edition

Head First Java, 2nd Edition

Kathy Sierra, Bert Bates
Head First Java, 3rd Edition

Head First Java, 3rd Edition

Kathy Sierra, Bert Bates, Trisha Gee
Learning Java, 6th Edition

Learning Java, 6th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck

Publisher Resources

ISBN: 9780596516680Errata PageSupplemental Content