Show TOC

Developing Distributed Applications Based on RMI-P4Locate this document in the navigation structure

Use

When developing distributed applications, you should comply with the Java EE 5 specification which includes the Enterprise JavaBeans (EJB) technology, the Java Naming and Directory Interface (JNDI), Application Client, and so on. If you implement these technologies in your distributed application, you will transparently benefit from the RMI-P4 features and functions such as load balancing, remote class loading and failover.

You might need to base your applications directly on RMI-P4 remote objects, rather than on EJBs, only in certain cases such as when porting an application based on Sun RMI , or for the sake of backward compatibility.

The distributed applications consist of a client part and a server part. A typical server part defines several remote objects and allows clients to request them by obtaining references to them. The client part obtains a reference to one or more objects from the server part, and calls their methods.

Procedure

You develop an RMI-P4 based application by first defining and implementing a remote object (that is, developing the server part of the application) and then implementing a client that calls remote methods of the remote object (that is, developing the client part of the application). The remote interface is the contract between the client and the server. The business logic of the application is concentrated in the server part. Binding the implementation to the Naming system makes the server part available to the client. Then, the client accesses the server part of the application.

The whole process of developing a distributed application consists of the following steps:

  1. Define a remote interface which specifies what methods are available remotely.

    More information: Defining a Remote Interface

  2. Implement the remote interface. This will create the server part of your application.

    More information: Implementing the Remote Interface

  3. Bind the implementation to the naming system to make it visible to the client.

    More information: Binding the Implementation to the Naming System

  4. Implement a client which will use the functionality of the server part.

    More information: Implementing a Client

  5. Access the server part of the application, for example EJBs, from a remote client.

    More information: Accessing Enterprise JavaBeans from Remote Clients