Home Segments Top Top Previous Next

1017: Mainline

To understand how remote method invocation works, you first imagine that there is a class, the RatingServer class, which defines a magical method for computing movie ratings, superior to all other known methods. Suspending disbelief, you learn that the magical method merely finds the best of the individual ratings; evidently, the method is for positive-attitude movie watchers.

public class RatingServer { 
 public int serverRating (Movie m) { 
  System.out.println("RatingServer asked for a rating"); 
  int s = m.getScript(); 
  int a = m.getActing(); 
  int d = m.getDirection(); 
  return 3 * Math.max(Math.max(s, a), d); 
 } 
}