Java Remote Methods Invocation
What is RMI
Remote Methods Invocation is the Java's API for distributed computing. By using RMI,
an object can access the methods of a remote object.
In this project, a server program is created to provide arithmetic functions to the
clients. A client program is also created to demonstrate this.
I will briefly explain how RMI is implemented in this project.
1. First a Java interface is created for the methods which is gonna be exported.
This would be: client/remoteMath.java
2. Then, an object is created that implements this interface. This object
inherits from "UnicastRemoteObject" This object is:
server/remoteMath_impl.java
3. To make this object available to others, it should be registered to RMI registry.
That is done by using bind() or rebind() method of the java.rmi.Naming class. Also to
activate the registry rmiregistry should be running during service.
That is done in this file:
server/remoteMath_Server.java
4. To use a remote object, client object should run the security
manager which is RMISecurityManager() method, and use lookup() object of
the java.rmi.Naming class. This method is accepts url like arguments, which is like
rmi://bowlingball.cacc.ncsu.edu/math . Basically, bowlingball.cacc.ncsu.edu is the
host in which the server is running, and math is the unique name given during
registering the remote object to RMI registry. These are done in
client/Calculator.java
For more information about RMI, these links can be checked out:
|