RMI

CIS007-3 – Comparative Integrated Systems

PowerPoint CIS007-3_Java Remote Method Invocation – March16


Practical 1
PowerPoint CIS007-3_RMI_Calculator Example – April 2016
For this exercise, you can use any application/IDE and Java compiler with which you feel comfortable – Notepad, Notepad++, BlueJ, Eclipse etc.

Java RMI Completed Example Code (ZIP)
A zipped file of completed working code

CIS007-3 Practical RMI Challenge Exercise


Practical 2
Java RMI Remote Greeting Instructions
This is taken from Head First Java – Chapter 18, Second Edition

Java RMI Remote Greeting Completed Example Code (ZIP)
Zipped file of completed working code


Practical 3
Another Java RMI Completed Example Code (ZIP)


Practical 4
More RMI to look at…
These exercises are taken from:
Liang, Y. Daniel (2013) Introduction to Java Programming – Comprehensive Version, Ninth Edition, Pearson

Chapter 46 Remote Method Invocation (Word Doc) RECOMMENDED

PowerPoint Chapter 46 Remote Method Invocation

Chapter 46 RMI Example Code Files
EX46-02
Ex46-07


Practical 5
Have a look at the RMI CalendarServer / CalendarClient program in the following document:
Chapter 13 – Remote Method Invocation (RMI)

Extra
A Short Java RMI Tutorial
Java RMI – Remote Method Invocation Tutorial
Java RMI Tutorial – Using Java RMI
RMI Notes
Sun Java RMI Tutorial (1997)
Tutorial Introduction to Java RMI
Using RMI Short Course


Java Remote Method Invocation (RMI)

(https://en.wikipedia.org/wiki/Java_remote_method_invocation)

The Java Remote Method Invocation (Java RMI) is a Java API that performs remote method invocation, the object-oriented equivalent of remote procedure calls (RPC), with support for direct transfer of serialized Java classes and distributed garbage collection.

  1. The original implementation depends on Java Virtual Machine (JVM) class representation mechanisms and it thus only supports making calls from one JVM to another. The protocol underlying this Java-only implementation is known as Java Remote Method Protocol (JRMP).
  2. In order to support code running in a non-JVM context, a CORBA version was later developed.

Usage of the term RMI may denote solely the programming interface or may signify both the API and JRMP, IIOP, or another implementation, whereas the term RMI-IIOP (read: RMI over IIOP) specifically denotes the RMI interface delegating most of the functionality to the supporting CORBA implementation.

The basic idea of Java RMI, the distributed garbage-collection (DGC) protocol, and much of the architecture underlying the original Sun implementation, come from the ‘network objects’ feature of Modula-3.


Grosso, William (2001) Java RMI, O’Reilly

Available in PDF format (PDF 2.3KB)
Download Code Examples from book

Java RMI contains a wealth of experience in designing and implementing Java’s Remote Method Invocation. If you’re a novice reader, you will quickly be brought up to speed on why RMI is such a powerful yet easy to use tool for distributed programming, while experts can gain valuable experience for constructing their own enterprise and distributed systems.With Java RMI, you’ll learn tips and tricks for making your RMI code excel. The book also provides strategies for working with serialization, threading, the RMI registry, sockets and socket factories, activation, dynamic class downloading, HTTP tunneling, distributed garbage collection, JNDI, and CORBA. In short, a treasure trove of valuable RMI knowledge packed into one book.

Designing and Building: The Basics of RMI Applications
Chapter 1 Streams
Chapter 2 Sockets
Chapter 3 A Socket-Based Printer Server
Chapter 4 The Same Server, Written Using RMI
Chapter 5 Introducing the Bank Example
Chapter 6 Deciding on the Remote Server
Chapter 7 Designing the Remote Interface
Chapter 8 Implementing the Bank Server
Chapter 9 The Rest of the Application
Chapter 10 Serialization
Chapter 11 Threads
Chapter 12 Implementing Threading
Chapter 13 Testing a Distributed Application
Chapter 14 The RMI Registry
Chapter 15 Naming Services
Chapter 16 The RMI Runtime
Chapter 17 Factories and the Activation Framework
Advanced Topics
Chapter 18 Using Custom Sockets
Chapter 19 Dynamic Classloading
Chapter 20 Security Policies
Chapter 21 Multithreaded Clients
Chapter 22 HTTP Tunneling
Chapter 23 RMI, CORBA, and RMI/IIOP


Trail : RMI – The Java Tutorials – The Oracle Java Documentation
(https://docs.oracle.com/javase/tutorial/rmi/)

This trail provides a brief overview of the RMI system and then walks through a complete client/server example that uses RMI’s unique capabilities to load and to execute user-defined tasks at runtime. The server in the example implements a generic compute engine, which the client uses to compute the value of the pi symbol.

trail icon An Overview of RMI Applications describes the RMI system and lists its advantages. Additionally, this section provides a description of a typical RMI application, composed of a server and a client, and introduces important terms.

trail icon Writing an RMI Server walks through the code for the compute engine server. This section will teach you how to design and to implement an RMI server.

trail icon Creating A Client Program takes a look at one possible compute engine client and uses it to illustrate the important features of an RMI client.

trail icon Compiling and Running the Example shows you how to compile and to run both the compute engine server and its client.


Fundamentals of RMI – Short Course
(http://dsnet.tu-plovdiv.bg/website/container/rmi/RMI.html)

Remote Method Invocation (RMI) technology, first introduced in JDKTM 1.1, elevates network programming to a higher plane. Although RMI is relatively easy to use, it is a remarkably powerful technology and exposes the average Java developer to an entirely new paradigm–the world of distributed object computing.

This course provides you with an in-depth introduction to this versatile technology. RMI has evolved considerably since JDK 1.1, and has been significantly upgraded under the Java 2 SDK. Where applicable, the differences between the two releases will be indicated.

Jguru.comFundamentals of RMI – Exercises
(http://dsnet.tu-plovdiv.bg/website/container/rmi/exercises.html)

Welcome to jGuru.com exercises for the Fundamentals of RMI short course.
These exercises illustrate the use of the Remote Method Invocation (RMI) library for implementing distributed objects.
When you finish these exercises, you will have a good idea of the essential concepts involved in building RMI-based distributed Java systems. With this foundation, you will be able to design and implement dsophisticated, multi-computer JavaTM programs.

Exercise Outline


Hello World!
(https://www.cs.ucsb.edu/~cappello/lectures/rmi/helloworld.shtml)

This is an abbreviated version of Sun’s tutorial titled Getting Started Using RMI. It is a distributed version of Hello World using Java RMI. In the distributed Hello World example, a client makes a remote method call to the server, to retrieve the message “Hello world!”.


java-rmiIntroduction to Java Remote Method Invocation : RMI – EJB Tutorial
(http://www.ejbtutorial.com/java-rmi/introduction-to-java-remote-method-invocation-rmi)

Java RMI is a specification for how Java Object  can be accessed  Remotely. Java RMI allows programmers to execute remote function class using the same semantics as local functions calls. The implementation of RMI is within the Java Remote Method Protocol ( JRMP ) library. The main Drawback of RMI is that it is a Java to Java Communication only.

A Remote Object is an object that resides on another computer and can be invoked remotely. Remote methods must include in their signature the throws RemoteException.

The Simple scenario for RMI is as follows:

  • The server must first bind its name to the registry
  • The client lookup the server name in the registry to establish remote references
  • The Stub serializing the parameters to skeleton, the skeleton* invoking the remote method and serializing the result back to the stub.java rmi

 

 

 

 

 

 

 

 

 

 

 

 

 


java-rmiA Step by Step Implementation Tutorial for Java RMI
(http://www.ejbtutorial.com/java-rmi/a-step-by-step-implementation-tutorial-for-java-rmi)

In this RMI Programming tutorial, we will learn how to create :

  • Simple Remote Object.
  • Server to instantiate (create ) and bind a remote object.
  • Client to invoke remotely an object

As RMI is a Java to Java only communication protocol, you need to install the Java Development Kit ( JDK ) as well as a programming editor ( IDE ) such as Eclipse.


Java Programming : Creating a simple java project using Eclipse
(http://www.learndb.com/java-programming/java-programming-creating-a-simple-java-project-using-eclipse)


java-rmiJava RMI Example : Simple Chat Program between Server and Client
(http://www.ejbtutorial.com/programming/java-rmi-example-simple-chat-program-between-server-and-client)

In this tutorial, we will create a simple chat program using two users. One user will be chatting from the server side, whilst the other user would be chatting from the client side of the RMI application.


java-rmiJava RMI Example : Group Chat Implementation
(http://www.ejbtutorial.com/programming/java-rmi-example-group-chat-implementation)

The aim of this tutorial is to take through a motivating example of getting multiple users to chat with each other from different PC. We will be creating a chat system whereby a message sent by a user, would be broadcasted to all users. There won’t be a GUI ( Graphical user interface ), instead, we will be using the console (cmd or terminal ) for messages.


java-rmiGroup Chat Example using Java RMI with a Graphical User Interface
(http://www.ejbtutorial.com/java-rmi/group-chat-example-using-java-rmi-with-a-graphical-user-interface)

The aim of this tutorial is to motivate you for creating a very simple project using Java RMI showing an basic example of a distributed system.

You may need to download Eclipse and Java JDK and get them installed on your machine regardless your operating system ( Windows or Linux ).

There are 4 parts in this tutorial, 1) Server Side + 2) Client Side. 3) Packaging 4) Running the Application.


Distributed Java: RMI Tutorial by Ian F. Darwin
(http://www.darwinsys.com/java/rmi/)

Table of Contents

Fundamentals of RMI – Short Course
(http://dsnet.tu-plovdiv.bg/website/container/rmi/RMI.html)

This short course covers the fundamentals of the Remote Method Invocation (RMI) technology, as found in the Java 2™ platform.


An Improved RMI Tutorial with Eclipse (Nomad Labs Code)
(http://code.nomad-labs.com/2010/03/26/an-improved-rmi-tutorial-with-eclipse/)

There are/have-been heaps of remoting frameworks in java, but RMI being part of the JRE/JDK and therefore having no external dependencies is my personal preference for remoting with java. Its main drawback: the wire protocol is not web-friendly and therefore difficult to go through firewalls (although it is possible). But if used behind the firewall, it makes for an excellent way to do distributed computing using only the JDK (OMG! only the JDK?! no Spring? or JMS?!). It does have several killer features that are found in very few (if any) remoting frameworks: callbacks and remote classloading. In this tutorial, you will see remote classloading. Ever since JRE 5.0, you don’t need to compile stubs (meaning you don’t need an extra compile-time step to get RMI working). I am guessing someone decided to do away with those and use the jdk dynamic proxies.

I wrote this tutorial after going through the most execelent RMI Tutorial by SUN/Oracle that you can find here.


Logo of the Java RMI Plug-in for EclipseRMI Plug-in for Eclipse – Version 2.0 – Java RMI – The Print Server Tutorial
(http://www.genady.net/rmi/v20/docs/tutorials/print_server.html)

n this “Print Server” tutorial you will create a simple Java RMI application and understand how the RMI Plug-in for Eclipse makes it simpler to develop and evolve RMI applications.


 Java RMI Tutorial
(http://www.ccs.neu.edu/home/kenb/09/fal/6520/rmi_tutorial.html)

This is a brief introduction to Java Remote Method Invocation (RMI). Java RMI is a mechanism that allows one to invoke a method on an object that exists in another address space. The other address space could be on the same machine or a different one. The RMI mechanism is basically an object-oriented RPC mechanism. CORBA is another object-oriented RPC mechanism. CORBA differs from Java RMI in a number of ways:

  1. CORBA is a language-independent standard.
  2. CORBA includes many other mechanisms in its standard (such as a standard for TP monitors) none of which are part of Java RMI.
  3. There is also no notion of an “object request broker” in Java RMI.

This tutorial attempts to show the essence of RMI, without discussing any extraneous features. Sun has provided a Guide to RMI, but it includes a lot of material that is not relevant to RMI itself. For example, it discusses how to incorporate RMI into an Applet, how to use packages and how to place compiled classes in a different directory than the source code. All of these are interesting in themselves, but they have nothing at all to do with RMI. As a result, Sun’s guide is unnecessarily confusing. Moreover, Sun’s guide and examples omit a number of details that are important for RMI.


Java RMI programming by example – Chris Greenhalgh, University of Nottingham, School of Computer Science and IT
(http://www.cs.nott.ac.uk/~pszcmg/G53ACC/java-rmi/rmi-tutorial.html)


Introduction to Java RMI – David Reilly
(http://www.javacoffeebreak.com/articles/javarmi/javarmi.html)

Remote method invocation allows applications to call object methods located remotely, sharing resources and processing load across systems. Unlike other systems for remote execution which require that only simple data types or defined structures be passed to and from methods, RMI allows any Java object type to be used – even if the client or server has never encountered it before. RMI allows both client and server to dynamically load new object types as required. In this article, you’ll learn more about RMI.


Learn Java RMI – Introduction to Java RMI
(http://www.learn-rmi.thiyagaraaj.com/)

Remote method invocation allows applications to call object methods located remotely, sharing resources and processing load across systems. Unlike other systems for remote execution which require that only simple data types or defined structures be passed to and from methods, RMI allows any Java object type to be used – even if the client or server has never encountered it before. RMI allows both client and server to dynamically load new object types as required. In this article, you’ll learn more about RMI.


Java logoGetting Started Using Java RMI
(http://download.java.net/jdk9/docs/technotes/guides/rmi/hello/hello-world.html)

This tutorial shows you the steps to follow to create a distributed version of the classic Hello World program using Java Remote Method Invocation (Java RMI). While you work through this example, you will probably come up with a number of related questions. You may find answers in the Java RMI FAQ.

The distributed Hello World example uses a simple client to make a remote method invocation to a server which may be running on a remote host. The client receives the “Hello, world!” message from the server.


Java Remote Method Invocation – Java RMI Tutorial
(http://o7planning.org/web/fe/default/en/document/13322/java-remote-method-invocation-java-rmi-tutorial#a13351)


studytonight logoRMI Application
(http://www.studytonight.com/java/rmi-in-java)

Remote method invocation(RMI) allow a java object to invoke method on an object running on another machine. RMI provide remote communication between java programs. RMI is used for building distributed applications.


A Generic Compute Engine
(https://www.cs.ucsb.edu/~cappello/lectures/rmi/computeEngine.html)

This page is based on the Java rmi tutorial on java.sun.com.
The compute engine server:

  • accepts tasks from clients
  • executes the tasks
  • returns any results, if any.

It is comprised of an interface and a class.  The interface defines the client’s view of the remote object, the compute server; the class provides the server’s implementation.


Hello World!
(https://www.cs.ucsb.edu/~cappello/lectures/rmi/helloworld.html)

This is an abbreviated version of Sun’s tutorial titled Getting Started Using RMI.

It is a distributed version of  Hello World using Java RMI.

In the distributed Hello World example, a client makes a remote method call to the server, to retrieve the message “Hello world!”. When the client runs, “Hello world!” is output to the client’s System.out stream.


Hello World! as a Java Applet
(https://www.cs.ucsb.edu/~cappello/lectures/rmi/applet.html)

  • We are interested now in focusing on those changes that have to be made to make HelloClient.java an applet.
  • In what follows, we assume that the applet runs in the appletviewer.
  • Modification are indicated in red.
  • In this example, I have created a package called examples.helloApplet.
  • To properly access the class files that we create and put into it, we set the CLASSPATH environment variable to the directory in which examples/helloApplet is rooted.
  • For example, if our packages our in $home/packages, then we set CLASSPATH to $home/packages.

A Simple Chat Application
(https://www.cs.ucsb.edu/~cappello/lectures/rmi/chatNew.html)

This is a simple chat application.  The basic idea is to have several client applets who chat with each other.  That is, what they type in their TextFields appears on every client’s TextArea—a chat session.  To do this, each client must first register with a server (an act that is posted to all current clients).  When a client contributes a comment, it is sent to the server, who forwards the message to each of the clients.

This basic logic could, for example, be used to implement a collaborative “white board” application.


RMI (Remote Method Invocation)
(http://www.javatpoint.com/RMI)

The RMI (Remote Method Invocation) is an API that provides a mechanism to create distributed application in java. The RMI allows an object to invoke methods on an object running in another JVM.


Introduction To Java RMI – Tutorial
(https://www.youtube.com/watch?v=3fq4AdaiGFA)

https://www.youtube.com/watch?v=3fq4AdaiGFA

Uploaded on 23 Feb 2012
http://www.zaneacademy.com | download source code @ http://sites.fastspring.com/zaneacade…

| 00:00 What interface extends from java.rmi.Remote?
| 01:00 Which methods in Java RMI throw RemoteException and why?
| 01:45 What objects can be passed from the client to the server in RMI?
| 02:10 What is a skeleton in Java RMI?
| 02:40 Why extend from UnicastRemoteObject in Java RMI?
| 04:10 What is a stub in Java RMI?
| 05:10 How is an object bound to the registry (rmiregistry) in Java RMI?
| 07:00 How is a lookup performed in Java RMI?
| 09:55 How is a Java RMI stub generated?
| 10:20 How is the path set from the command prompt?
| 11:10 what is rmic in Java RMI?
| 12:40 How to run the rmiregistry in Java Remote Method Invocation?
| 16:00 Where is the proxy pattern implemented in Java RMI?