DEV Community

PGD
PGD

Posted on

RMI (Remote Method Invocation)

RMI (Remote Method Invocation) is an API provided by J2EE platform that defines methods for applications in different systems (JVM in running) to communicate by invocating a method. It defines methods to communicate with different applications in distributed system environment.
RMI provides two objects, each called stub and skeleton. Both stub and skeleton are for building connection. A stub is the object for client-side application and a skeleton is for server-side application.
Once the client invokes a method of stub object, then the stub processes the following tasks.

  • Build a connection to the remote machine (JVM).
  • Route to the server.
  • Convert the parameter data of the remote method to call into a serialized data suitable for transmission (Marshaling).
  • Wait for result from the remote method.
  • Read the result or exception (Unmarshalling).
  • Return the result to the caller.

Once the server receives the signal, then the skeleton process the following tasks.

  • Unmarshall parameters.
  • Invoke the method providing the parameters.
  • Get the return from the method called and marshal it.
  • Send.

Distributed applications should perform the following process:

  • Locating remote method
  • Providing communication with the remote object.
  • Load class definition the method belongs to.

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs