plz tell me Internal execution of RMI application

1

1234java

hi
iam learing the RMI .i write first basic application but how the
RMI application is executing iam not getting...tell me how the
execution is performed......with internal details.......step by step
clearly......

client application:

public class Client {
public static void main(String arf[])throws Exception {
java.rmi.Remote r=java.rmi.Naming.lookup("ic");
Implementationclass ic=(Implementationclass)r;
System.out.println(ic.rmprint());
System.out.println("-------client--------");
}
}

Registry application:


public class Myregister {
public static void main(String ar[])throws Exception {
Implementationclass objRemote=new Implementationclass();
java.rmi.Naming.bind("ic",objRemote);
System.out.println("------object binded----");
}
}

interface:

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface Myinterface extends Remote {
public String rmprint()throws RemoteException;
}

implementaion class:


import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class Implementationclass extends UnicastRemoteObject
implements Myinterface {
public Implementationclass() throws RemoteException {
}
public String rmprint() {
System.out.println("--------in print
method:Implementationclass-------");
return "--------output from RMI--------";
}
}.

---------------------------------------------------------------------------------------------

when RemoteObject is created, internally wht happend when it is
created........how it is n/w enabled...wht happend when it is n/w
enabled.....where println statements r diplayed..... plz tell me step
by step procedure clearly.......bcz iam new to RMI...........
 
E

EJP

Implementationclass ic=(Implementationclass)r;

That should read MyInterface ic = (MyInterface)r;
when RemoteObject is created, internally wht happend when it is
created

It is 'exported' by the RMI Runtime system.
how it is n/w enabled

This happens when it is exported by the RMI runtime system.
wht happend when it is n/w enabled

It becomes ready to receive incoming remote calls via a TCP listening
socket.
where println statements r diplayed

Wherever the JVM that executes them is running.
plz tell me step by step procedure

1. A remote object is exported.
2. It can be bound in the RMI registry, or returned as the result of
another remote method.
3. The client acquires the stub for the object, from the Registry or via
another remote method on another remote object.
4. The client executes methods on the stub, which are marshalled and
passed over the network to the exporting JVM, where they are executed,
and the return value or exception is returned over the network to the
client.

You should read the the RMI Tutorial.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top