The K Zone, Home

About Me

K View

Projects

Papers

Gallery

Email

 

 

 
 

Evaluation of RMI - Page 7

 

Back to Contents Page

 
 

 

3. Comparison of Client/Server Model Implementation

3.3. Implementation of Client/Server Model's
Full code implementation and application outputs can be found in Appendix A, RMI, and Appendix B, Socket, at the end of the report.

3.3.1 RMI Implementation
The RMI implementation will be based upon the implementation introduced by Devai [6]. The implementation is formed of four objects. The first three have been introduced in section 2.1 - RMI (interface, server and client). The additional object is the implementation object. This is not embedded within the server but implemented in its own object.

Interface (NumFun.java)
The interface declares the services. As the services will be accessed remotely the interface extends the remote interface. Services declared within a remote interface must throw the remoteException.
Our application has three services (isPrime(), gcd() and lcm()) and their declaration is illustrated in figure 10.

public boolean isPrime(long n) throws RemoteException;
public long gcd(long a, long b) throws RemoteException;
public long lcm(long a, long b) throws RemoteException;

Implementation (NumFunIm.java)
Residing on the server side, the implementation object provides the implementation of the primality services declared in the interface.

Server (NFServer.java)
The server creates an implementation object then, using the java.rmi.Naming method rebind, registers itself and its listening port with the rmi registry service.

Client (NFClient.java)
The client takes three arguments then, using the java.rmi.Naming method lookup, finds the remote implementation class. An object of its class is created and the three arguments are passed to the objects remote methods.
The returned values are outputted to the user.


Next Page

 

 

Home | About Me | K View | Projects | Papers | Gallery | Email