To invoke a remote object the client needs a reference of that object At that

To invoke a remote object the client needs a

This preview shows page 10 - 18 out of 24 pages.

To invoke a remote object, the client needs a reference of that object. At that time, the client fetches the object from the registry using its bind name (using lookup() method).
Image of page 10

Subscribe to view the full document.

Requirements for distributed applications If any application performs these tasks, it can be distributed application. The application need to locate the remote method It need to provide the communication with the remote objects, and The application need to load the class definitions for the objects. The RMI application have all these features, so it is called the distributed application.
Image of page 11
Steps to writing a Java distributed Application Create the remote interface Provide the implementation of the remote interface Develop server program Develop client program Compile application Execute the application
Image of page 12

Subscribe to view the full document.

Defining remote interface A remote interface provides the description of all the methods of a particular remote object. The client communicates with this remote interface. To create a remote interface − Create an interface that extends the predefined interface Remote which belongs to the package. Declare all the business methods that can be invoked by the client in this interface. Since there is a chance of network issues during remote calls, an exception named RemoteException may occur; throw it. Following is an example of a remote interface. Here we have defined an interface with the name Hello and it has a method called printMsg() .
Image of page 13
Image of page 14

Subscribe to view the full document.

Implementing Remote Interface We need to implement the remote interface created in the earlier step. We can write an implementation class separately or we can directly make the server program implement this interface. To develop an implementation class − Implement the interface created in the previous step. Provide implementation to all the abstract methods of the remote interface.
Image of page 15
Image of page 16

Subscribe to view the full document.

Developing Server Program An RMI server program should implement the remote interface or extend the implementation class.
Image of page 17
Image of page 18
  • Spring '18
  • Daniel Machanje

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes