Writing an Implementation Class
for a Remote Interface





To implement a remote object, you write a class that implements one or more remote interfaces. The implementation class needs to:

  1. Specify the remote interface(s) being implemented.

  2. Define the constructor for the remote object.

  3. Provide implementations for the methods that can be invoked remotely.

Then we write a server application class to

  1. Create and install a security manager.

  2. Create one or more instances of a remote object.

  3. Register at least one of the remote objects with the RMI remote object registry, for bootstrapping purposes.

Arguments to, or return values from, remote methods can be of any Java type, including objects, as long as those objects implement the interface java.io.Serializable. Most of the core Java classes in java.lang and java.util implement the Serializable interface.

Next is the source for the ThermometerImpl.java file, that contains the code for the implementation of the Thermometer server. In this code, we use the observer/observable paradigm as before, but because of a lack of multiple inheritance, we choose to reimplement the methods.