Remote Method Invocations

The Remote Method Invocation mechanism lets you do something that sounds simple. If you have access to an object on a different machine, you can call methods of the remote object. Of course, the method parameters must somehow be shipped to the other machine, the server must be informed to execute the method, and the return value must be shipped back. RMI handles these details.

For example, the client seeking product information can query a Warehouse object on the server. It calls a remote method, find, which has one parameter: a Customer object. The find method returns an object to the client: the Product object (see Figure 5-3).

Figure 5-3. Invoking a remote method on a server object

In RMI terminology, the object ...

Get Core Java™ 2 Volume II - Advanced Features, Seventh Edition 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.