RMI (Remote Method Invocation)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EYE4U
    Banned
    New Member
    • Oct 2008
    • 76

    RMI (Remote Method Invocation)

    What is RMI?

    Remote Method Invocation (RMI) facilitates object function calls between Java Virtual Machines (JVMs). JVMs can be located on separate computers yet one JVM can invoke methods belonging to an object stored in another JVM. Methods can even pass objects that a foreign virtual machine has never encountered before, allowing dynamic loading of new classes as required.

    Basic Steps to Write your Own RMI Service
    • Writing RMI Server
    • Writing an Interface
    • Implementing the Interface
    • Writing RMI Client


    How to Run?

    You just need to register your RMI service with your operating system.
    HOW?
    Following are the steps to register and run RMI Service.
    • Start RMI Registry
    • Compile the Server and Client
    • Start the Server and Client

    Start RMI Registry :

    To start the registry, Windows users should do the following (assuming that your java\bin directory is in the current path)
    start rmiregistry

    To start the registry, Unix users should do the following
    rmiregistry &

    Compile the Server

    Compile the server, and use the rmic tool to create stub files.

    Start the Server

    From the directory in which the classes are located, type the following
    java PowerServiceSer ver

    Start the Client

    You can run the client locally, or from a different machine. In either case, you'll need to specify the hostname of the machine where you are running the server. If you're running it locally, use localhost as the hostname.

    java PowerServiceCli ent localhost

    I have attached a simple RMI example :)

    Regards
    ARUZ
    Last edited by Niheel; Sep 1 '24, 06:22 PM.
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    I've taken this text (back) to the editors section because you have used a very old version of RMI (see the generated skeleton and stub files). Please update your code and RMI description before posting in the Insights section again.

    kind regards,

    Jos (moderator)

    Comment

    Working...