Distributed Object Schemes for Java

While there are several distributed object schemes that can be used within the Java environment, we’ll only cover two that qualify as serious options for developing your distributed applications: CORBA and RMI. Both of them have their advantages and their limitations, which we’ll look at in detail in the following sections.

During this discussion, we’ll be using an example involving a generic problem solver, which we’ll distribute using both CORBA and RMI. We’ll show in each case how instances of this class can be used remotely using these various object distribution schemes. A Java interface for the example class, called Solver , is shown in Example 3.1. The Solver acts as a generic compute engine that solves numerical problems. Problems are given to the Solver in the form of ProblemSet objects; the ProblemSet interface is shown in Example 3.2. The ProblemSet holds all of the information describing a problem to be solved by the Solver. The ProblemSet also contains fields for the solution to the problem it represents. In our highly simplified example, we’re assuming that any problem is described by a single floating-point number, and the solution is also a single floating-point value.

Example 3-1. A Problem Solver Interface
package dcj.examples; import java.io.OutputStream; // // Solver: // An interface to a generic solver that operates on ProblemSets // public interface Solver { // Solve the current problem set public boolean solve(); // Solve ...

Get Java Distributed Computing now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.