Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

plz tell me Internal execution of RMI application

Thread view: 
1234java@gmail.com - 22 Dec 2007 18:08 GMT
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...........
EJP - 24 Dec 2007 02:21 GMT
>   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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.