Remote Method Invocation (RMI)
Example: Displaying Objects(Thermometers) on Separate Machines Using RMI






For this purpose we need three components for each remotely callable object. For our application, both the thermometer object and the observer objects must call each other. We want the thermometer to execute on one machine and each observer to execute on its own separate machine.

So we need to implement remote objects for both the thermometer and the observer canvas. Thus we need two sets of three components for each. They are:

  1. public interface Thermometer extends java.rmi.Remote

  2. public class ThermometerImpl extends UnicastRemoteObject
          implements Thermometer, java.io.Serializable

  3. public class ThermApplication implements java.lang.Runnable
and
  1. public interface ThermObserver extends java.rmi.Remote

  2. public class ThermObserverImpl extends Canvas implements ThermObserver

  3. public class ObserverAppl extends Frame