Chapter 18. Remote Deployment with RMI: Distributed Computing

image with no caption

Being remote doesn’t have to be a bad thing. Sure, things are easier when all the parts of your application are in one place, in one heap, with one JVM to rule them all. But that’s not always possible. Or desirable. What if your application handles powerful computations, but the end-users are on a wimpy little Java-enabled device? What if your app needs data from a database, but for security reasons, only code on your server can access the database? Imagine a big e-commerce back-end, that has to run within a transaction-management system? Sometimes, part of your app must run on a server, while another part (usually a client) must run on a different machine. In this chapter, we’ll learn to use Java’s amazingly simple Remote Method Invocation (RMI) technology. We’ll also take a quick peek at Servlets, Enterprise Java Beans (EJB), and Jini, and look at the ways in which EJB and Jini depend on RMI. We’ll end the book by writing one of the coolest things you can make in Java, a universal service browser.

image with no caption

Method calls are always between two objects on the same heap

So far in this book, every method we’ve invoked has been on an object running in the same virtual machine as the caller. In other words, the calling object and the callee ...

Get Head First Java, 2nd 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.