Chapter 13

Lazy Activation

 

 

Universal TeacherIn all the previous examples, the server class extended the UnicastRemoteObject class to create and export a remote object. The UnicastRemoteObject class defines a remote object whose references are valid only while the server process is alive. In order to obtain a reference to a remote object, the server process must be running. This mechanism is sufficient for small applications.

If a distributed application were made of thousands of objects, it would be impractical for object implementations to remain active for indefinite period of time. It would be better if the programs could be started automatically when their objects are needed. Java 1.2 adds a new feature of automatic activation of remote objects. The activation system provides two main features:

The ability to have remote objects instantiated on demand, and
the ability to store persistent references to a remote object across server crashes.


Universal TeacherObject Activation

Object activation is a process of transforming a passive (not active) object into an active object. It allows objects to begin execution on demand. The main difference between an activatable remote object and a non-activatable object is that a remote reference to an activatable object does not need to have a live object behind it.

This chapter shows an example of lazy activation. The source code needed for this example is stored in the examples\Lazy directory. The "Lazy" directory contains the following files:

  • LazyInterface.java
  • LazyServerImpl.java
  • Setup.java
  • Client.java
  • Policy.txt
  • Compile.bat
  • Rmicompile.bat
  • RunSetup.bat
  • RunClient.bat
  • Runrmid.bat
  • StartRegistry.bat

 

 

 

RMI BOOK MAIN PAGE                Top

  
Copyright © 2001 www.universalteacher.com