EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

RMI Architecture

By Priya PedamkarPriya Pedamkar

Home » Software Development » Software Development Tutorials » Java Tutorial » RMI Architecture

RMI Architecture

Overview of RMI Architecture

In distributed application architecture, it is always a need for communication between two different applications. In Java-based applications, one application communicates with another remote/different application running somewhere else by using a mechanism called RMI architecture.

RMI stands for Remote Method Invocation. It is an API provided by java that allows an object residing in one JVM (Java Virtual Machine) to access or invoke an object running on another JVM. The other JVM could be on the same machine or remote machine. This is an interesting feature because, in real-time applications, it becomes very easy for Java applications to communicate directly with each other without any external communication mechanism. Also, it is always a need for secure communication between applications based on distributed application architecture.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

RMI Design

RMI-DesignDone

Before we go into detailed architecture, we will understand the basic design of RMI architecture.

  • RMI API is provided in the package java.rmi. Let’s introduce two terms for the understanding of RMI design architecture. First is the client; the JVM that will call the remote object; second is the server; the JVM contains the remote object. So, the client will call the server, in this case, on the object for method invocation.
  • The server will then return the reference of the object to the client. The catch here is both the objects, i.e. local and remote, will appear as a local object on the server. There will be no differentiation between the two. The syntax of the methods of both objects is also the same. Therefore, the server JVM acts like a normal JVM without knowing of any object whether it is local or remote.
  • The same object can be both a server and a client. The remote objects reference is obtained, and it is used as if it was a local object. The RMI infrastructure is responsible for finding the remote object, intercepting method call and processing the remote request remotely. The client invokes methods on the object only after obtaining a reference to a remote object.

RMI Architecture

Below is the diagram of RMI architecture in a simple way. On the internet, you will find various forms of the same architecture, but we have a simple one that will help to explain it better.

RMI-ArchitectureDone

Let’s start by connecting dots from a design perspective with an architecture diagram.

The client application and server application are the respective JVMs of the client machine and server machine. In the RMI application, we write two programs: the client program, which resides on the client, and the server program, which resides on the server machine.

Popular Course in this category
Java Training (40 Courses, 29 Projects, 4 Quizzes)40 Online Courses | 29 Hands-on Projects | 285+ Hours | Verifiable Certificate of Completion | Lifetime Access | 4 Quizzes with Solutions
4.8 (8,993 ratings)
Course Price

View Course

Related Courses
JavaScript Training Program (39 Courses, 23 Projects, 4 Quizzes)jQuery Training (8 Courses, 5 Projects)Free Java Online CourseJavaFX Training (1 Courses)

Application Layer

This layer is the actual systems, i.e. client and server, which are involved in communication. The java program on the client side communicates with the java program on the server-side.

Stub

We have client objects from the design intro; In RMI architecture, it is known as Stub. It is an object that resides on the client machine, and it acts as a proxy for the remote object. It is like a gateway for the client program.

The stub has the same methods as a remote object. When the client calls on the stub object, the stub forwards this request to a remote object (Skeleton) via RMI infrastructure, which is then executed on the server.

Stub Performs the following events:-

  1. Initiates connection with remote JVM,
  2. Writes and transmits (Marshals) parameters to remote JVM,
  3. Waits for the result,
  4. Reads (Unmarshalls) the returned result,
  5. Pass the received result to the caller.

Skeleton

The server object which resides in a server machine is known as Skeleton. Stub communicates with server application with the help of an intermediate Skeleton object.

The responsibility of the skeleton object is to send parameters to method implementation and send the return values back to the client.

Skeleton Performs the following events:-

  1. Reads the parameter passed by the client,
  2. Invokes the method on actual Remote object,
  3. Transmit/pass the result to the caller.

Stub / Skeleton layer

  • The Stub/Skeleton layer is responsible for intercepting calls made by the client and redirecting these calls to the remote object. This layer is also called as Proxy Layer. Stub and Skeleton are the proxies for client and server. The Stub and Skeleton objects are like an interface between an application and the rest of the RMI System.
  • This layer’s purpose is to transfer data to Remote Reference Layer by Object Serialization. This process of converting data/object into byte stream is known as Marshalling, and the reverse is known as Unmarshalling. Marshaling is performed when requesting the object from the server, and Unmarshalling is performed when data/object reference is received from the server.

Remote Reference Layer

  • The proxy layer is connected to the RMI mechanism through the Remote Reference Layer. This layer is responsible for the communication and transfer of objects between client and server. The invocation semantics of the RMI connection is defined and supported by this layer.
  • The remote Reference Layer is responsible for maintaining the session during the method call. i.e. It manages the references made by the client to the remote server object. This layer is also responsible for handling duplicated objects.

Transport Layer

The transport layer is responsible for setting up communication between the two machines. This layer uses standard TCP/IP protocol for connection. The actual transportation of data is performed through this layer. This layer is part of the Remote Reference Layer.

Conclusion

  • The Remote Method Invocation (RMI) is a very useful API provided in JAVA that helps in communication between two different JVMs. It allows an object to invoke a method on an object residing in another address space.
  • It provides a secure way for applications to communicate with each other. It achieves this functionality by the means of concepts Stub (Client calling object) and Skeleton (Remote object residing on the server).
  • RMI is used to build distributed applications. It preserves the type of safety. RMI architecture minimizes the complexity of the application in a distributed architecture.

Recommended Articles

This has been a guide to RMI Architecture. Here we discuss RMI design and the architecture in detail with an appropriate block diagram. You can also go through our other suggested articles to learn more –

  1. Data Warehouse Architecture
  2. What is the TCP Protocol?
  3. What is Desktop Software?
  4. CCNA Interview Questions

Java Training (40 Courses, 29 Projects, 4 Quizzes)

40 Online Courses

29 Hands-on Projects

285+ Hours

Verifiable Certificate of Completion

Lifetime Access

4 Quizzes with Solutions

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Java Tutorial
  • Basic
    • What is Java?
    • What is JNDI in Java
    • What is JNI in Java
    • What is Java Interface
    • What is Java SE
    • What is JavaBeans
    • Install JDK
    • Java Programming Language Features
    • Applications of Java
    • Career in Java
    • Versions of Java
    • Java Virtual Machine
    • Java GUI Framework
    • Java Packages
    • Java Package Example
    • Default Package in Java
    • Variables in Java
    • Instance Variable in Java
    • Object in Java
    • Java Commands
    • Iterator in Java
    • Java Booleans
    • Conversion in Java
    • Type Conversion in Java
    • String in Java
    • What is JDK
    • What is JVM
    • What is J2EE
    • RMI Architecture
    • Java Literals
    • Data Types in Java
    • Primitive Data Types in Java
    • Enumset in Java
    • Cheat Sheet Java
    • IntelliJ Cheat Sheet
  • Frameworks
    • Best Java Compilers
    • Frameworks In Java
    • Testing Frameworks for Java
    • Java Monitoring Tool
    • Best Java IDE
    • Java Compilers
    • Java Tools
    • Java Deployment Tools
    • Types of Memory in Java
    • Java References
    • Java Type Inference
    • Java Boolean to String
    • Java String to Float
    • java.net Package
    • Java Formatter
  • Operators
    • Arithmetic Operators in Java
    • Unary Operators in Java
    • Logical Operators in Java
    • Comparison Operators in Java
    • Assignment Operators in Java
    • Java String Operators
    • Conditional Operator in Java
    • Boolean operators in Java
  • Keywords
    • Java Keywords
    • this Keyword in Java
    • Static Keyword in Java
    • Native keyword in Java
    • Throw Keyword in Java
    • Throws Keyword in Java
    • What is public in Java?
    • Private in Java
    • Protected Keyword in Java
    • Final Keyword in Java
  • Control statements
    • Control Statement in Java
    • Else-If Statement in Java
    • Nested if Statements in Java
    • Continue Statement in Java
    • Break Statement in Java
    • Case Statement in Java
  • Loops
    • Loops in Java Programming
    • For Loop in Java
    • While Loop in Java
    • do-while loop in Java
    • For-Each loop in Java
    • Nested Loop in Java
  • Inheritance
    • Inheritance in Java
    • Single Inheritance in Java
    • Multilevel Inheritance in Java
    • Hierarchical Inheritance in Java
    • Hybrid Inheritance in Java
  • Constructor and destructor
    • Constructor and Destructor in Java
    • Constructor in Java
    • Destructor in Java
    • Copy Constructor In Java
    • Static Constructor in Java
    • Private Constructor in Java
  • Array
    • Arrays in Java Programming
    • 2D Arrays in Java
    • 3D Arrays in Java
    • Multidimensional Array in Java
    • Array Methods in Java
    • Print 2D Array in Java
    • Print Array in Java
    • String Array in Java
    • Associative Array in Java
    • Dynamic Array in Java
    • Java Array Iterator
    • Java array.push
    • Sort String Array in Java
  • Sorting
    • Sorting in Java
    • Sorting Algorithms in Java
    • Merge Sorting Algorithms in Java
    • Quick Sorting Algorithms in Java
    • Selection Sort In Java
    • Heap Sort In Java
    • Bubble Sort in Java
    • Merge Sort In Java
    • Quick Sort in Java
    • Insertion Sort in Java
    • Sort String in Java
    • Program for Merge Sort in Java
  • Functions
    • String Functions in java
    • Math Functions in Java
    • Hashing Function in Java
    • Regular Expressions in Java
    • Recursion in Java
    • Java Callback Function
    • Java Call by Value
    • Java Call by Reference
    • HashMap in Java
    • Java String Concatenation
    • Java String Equals
    • Compare two Strings in Java
    • Virtual Function in Java
    • Java newInstance()
    • split() Function in Java
    • trim() Function in Java
    • Replace() Function in Java
    • substring() Function in Java
    • Strictfp in Java
    • String Reverse Function in Java
    • Java String getBytes
    • Java Replace Char in String
    • Shuffle() in Java
    • addAll() in Java
    • FileWriter in Java
    • Java Stream Filter
    • Java FileInputStream
    • replaceAll() in Java
    • repaint in Java
    • copy() in Java
    • Java max()
    • Java min()
    • Java Timestamp
    • Java URLConnection
    • Java StringJoiner
    • Java KeyStore
    • Java InetAddress
    • Java getMethod()
    • swap() in Java
    • Deadlock in Java
    • Range in Java
    • Java Repository
    • Java Dictionary
    • Calculator in Java
    • Mutable String in Java
    • Mutable vs Immutable Java
    • Native Methods in Java
    • StringBuffer Class in Java
    • String Class in Java
    • Java URL Class
    • Java Vector Class
  • Polymorphism
    • What is Polymorphism
    • Polymorphism in Java
    • Runtime Polymorphism in Java
    • Overloading and Overriding in Java
    • Overloading in Java
    • Method Overloading in Java
    • Function Overloading in Java
    • Overriding in Java
    • Method Overriding in Java
    • Final Keyword in Java
    • Super Keyword in Java
    • instanceOf in Java
    • Java Authenticator
    • Java Alias
  • Collections
    • What is TreeMap in Java?
    • Sorting in Collection
    • Java Collections Class
    • Hashtable in Java
    • Java EnumMap
    • Java LinkedHashMap
    • Reverse Linked List in Java
    • LinkedList in Java
  • Date Time
    • java.util.Date
    • Java Clock
    • Java Instant
    • Java LocalTime
    • Java ZoneId
    • Java ZoneOffset
    • Java varargs
    • Java LocalDate
    • Java OffsetDateTime
    • Java LocalDateTime
    • Java Duration
    • Java DayOfWeek
    • Java Period
    • Timer in Java
    • Java TimeZone
    • Java Date Picker
  • Advanced
    • Methods in Java
    • Serialization in Java
    • Inner Class in Java
    • Anonymous Inner Class in Java
    • Java Stack Methods
    • Java Static Nested Class
    • Synchronized Block in Java
    • Static Synchronization in Java
    • Abstract Class in Java
    • Access Modifiers in Java
    • Non Access Modifiers in Java
    • Bit Manipulation in Java
    • Encapsulation in Java
    • Singleton Class in Java
    • Wrapper Class in Java
    • Nested Class in Java
    • Java Matcher
    • Java Pattern Class
    • Java File Class
    • Final Class in Java
    • Stack Class in Java
    • Anonymous Class in Java
    • StringBuilder Class in Java
    • StringBuffer in Java
    • Java Directories
    • JSON in Java
    • Object Class in Java
    • What is Multithreading in java
    • Java Thread Priority
    • Daemon Thread in Java
    • Java Thread Pool
    • Java ThreadLocal
    • Association in Java
    • Queue in Java
    • Functional Programming in Java
    • ClassLoader in Java
    • Interface in Java
    • Functional Interface in Java
    • Java Queue Interface
    • Collection Interface in Java
    • Object Cloning in Java
    • Java.net URI
    • Java Assertion
    • Vector in Java
    • Applets in Java
    • Template in Java
    • Java Shutdown Hook
    • 2D Graphics in Java
    • Autoboxing and Unboxing in Java
    • Comparable in Java Example
    • Java Annotations
    • Java User Input
    • Serialization in Java
    • Dynamic Binding in Java
    • Java Parse String
    • Java Adapter Classes
    • Immutable Class in Java
    • String Initialization in Java
    • String Manipulation in Java
    • ThreadGroup in Java
    • Java Iterate Map
    • Java IO
    • Java?OutputStreamWriter
    • DataInputStream in Java
    • Java BufferedReader
    • Java BufferedWriter
    • Java BufferedInputStream
    • Java ByteArrayInputStream
    • Java ByteArrayOutputStream
    • Java RandomAcessFile
    • Java PrintStream
    • Java PrintWriter
    • Java URLEncoder
    • Java Scanner Class
    • Java Console
    • Java Runtime class
    • Java Base64
    • Java Base64 Encoding
    • Java Base64?Decode
    • Finalize in Java
    • Java Parallel Stream
    • Java Getter Setter
    • Set Interface in Java
    • How to Connect Database in Java
    • How to Create Webservice in Java
    • Composition in Java
    • BinarySearch() in Java
    • Exception Handling in Java
    • Java NullPointerException
    • Java NoSuchElementException
    • Java ConcurrentModificationException
    • Java ArithmeticException
    • Java IOException
    • Java RuntimeException
    • NumberFormatException in Java
    • Java ArrayIndexOutOfBoundsException
    • Java ClassNotFoundException
    • Java FileNotFoundException
    • Java InterruptedException
    • Finally in Java
    • Java Default Method
    • Java Locale
    • Tuples in Java
    • Java ServerSocket
    • Java Lambda Expressions
    • Java DatagramSocket
    • Java Animation
  • MISc
    • What is Synchronization in Java
    • What is Concurrency in Java
    • What is Design Pattern in Java
    • What is Generics in Java
    • What is API in Java
    • What is a Binary Tree in Java
    • What is Java Garbage Collector
    • What is Java Inheritance
    • Thread Life cycle in Java
    • Object Oriented Programming in Java
    • Java App Development
    • Java Naming Conventions
    • Java hashCode()
    • Java Transient
    • JSTL In Java
    • Comparable in Java 
    • Aggregation in Java
    • EJB in Java
    • @deprecated in Java
    • Java @Inherited
    • @SuppressWarnings in Java
    • Java @Override
  • Programs
    • Patterns in Java
    • Star Patterns in Java
    • Number Patterns in Java
    • Swapping in Java
    • Factorial in Java
    • Fibonacci Series in Java
    • Reverse Number in Java
    • Palindrome in Java
    • Armstrong Number in Java
    • Squares in Java
    • Square Root in Java
    • Special Number in Java
    • Anagram Program in Java
    • Strong Number in Java
    • Random Number Generator in Java
    • Matrix Multiplication in Java
    • Socket Programming in Java
    • Prime Numbers in Java
    • String Comparison in Java
    • Leap Year Program in Java
    • Reverse String in Java
    • Design Patterns in Java
    • Happy Numbers in Java
  • Interview Questions
    • Java Interview Questions
    • Java Inheritance Interview Questions
    • Java EE Interview Questions
    • Java Developer Interview Questions
    • Java Collection Interview Questions
    • Java Interview Question on Multithreading
    • Java String interview question
    • Java Testing Interview Questions
    • Java Multi-threading Interview Questions
    • Multithreading Interview Questions in Java
    • Oops Java Interview Questions
    • Java Spring Interview Questions
    • Data Structure Java Interview Questions
    • Java Web Services Interview Questions

Related Courses

Java Course

JavaScript Certification Course

jQuery Training Course

Java Training Courses

Free Java Training Courses

JavaFX Training

Java Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - Java Training (40 Courses, 29 Projects, 4 Quizzes) Learn More