plz tell me Internal execution of RMI application

Discussion in 'Java' started by 1234java@gmail.com, Dec 22, 2007.

  1. Guest

    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...........
    , Dec 22, 2007
    #1
    1. Advertising

  2. EJP Guest

    wrote:
    > 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.
    EJP, Dec 24, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. brian

    Size of my Struct? PLZ PLZ reply

    brian, Nov 23, 2004, in forum: C Programming
    Replies:
    7
    Views:
    408
    -berlin.de
    Nov 25, 2004
  2. Replies:
    1
    Views:
    367
  3. Replies:
    2
    Views:
    325
    Nick Keighley
    Nov 24, 2006
  4. Replies:
    1
    Views:
    330
  5. nocturnal
    Replies:
    1
    Views:
    509
    nocturnal
    Jul 10, 2009
Loading...

Share This Page