RMI and steps involved in developing an RMI object
Remote Method Invocation (RMI) allows java
object that executes on one machine and to invoke the method
of a Java object to execute on another machine.
The steps involved in developing an RMI object are:
a) Define the interfaces
b) Implementing these interfaces
c) Compile the interfaces and their
implementations with the java compiler
d) Compile the server implementation with RMI
compiler
e) Run the RMI registry
f) Run the application
RMI
architecture
RMI architecture consists of four layers and
each layer performs specific functions:
a) Application layer ---- contains the actual object
definition
b) Proxy layer ---- consists of stub and skeleton
c)
RemoteReferencelayer ---- gets the stream of bytes from the transport
layer and sends it to the proxy layer
d)
Transportation layer ---- responsible
for handling the actual machine-to-machine communication
E:\rmi>dir
12/28/2010 01:15 PM 1,555 client.class
12/28/2010 01:14 PM 816 client.java
12/28/2010 12:32 PM 189 multiply.class
12/28/2010 12:31 PM 118 multiply.java
12/28/2010 12:39 PM 707 server.class
12/28/2010 12:39 PM 380 server.java
12/28/2010 01:17 PM 1,752 server_Stub.class
7 File(s) 5,517 bytes
E:\rmi>rmic server
E:\rmi>rmic
-v1.2 server
E:\rmi>start
rmiregistry
E:\rmi>java
server or from the dos window e:\rmi>start java server
server
starts
E:\rmi>java
client
Here
it will ask howmany do u want to purchase
Each
qty price what will be
Once again
E:\rmi>rmic server
in this implementation we have only 3 files such cases we must do rmic to the server program
E:\rmi>start
rmiregistry
E:\rmi>start
java server
E:\rmi>java
client
Remote
method invocation bill calculation
enter
the number of items purchased
10
enter
the unit price
2
The
total amount is 20
కామెంట్లు లేవు:
కామెంట్ను పోస్ట్ చేయండి