Java remote method invocation In computing, the is a Java Remote Method Invocation Java API that performs remote method invocation, the object-oriented equivalent of remote procedure calls, with support for direct transfer of serialized Java classes and distributed garbage-collection. The original implementation depends on Java Virtual Machine 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. In order to support code running in a non-JVM context, programmers later developed a CORBA version. 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 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 protocol, and much of the architecture underlying the original Sun implementation, come from the "network objects" feature of Modula-3. Generalized codeThe programmers of the original RMI API generalized the code somewhat to support different implementations, such as a HTTP transport. Additionally, the ability to pass arguments "by value" was added to CORBA in order to be compatible with the RMI interface. Still, the RMI-IIOP and JRMP implementations do not have fully identical interfaces. RMI functionality comes in the package, while most of Sun's implementation is located in the
sun.rmi package. Note that with Java versions before Java 5.0 developers had to compile RMI stubs in a separate compilation step using
. Version 5.0 of Java and beyond no longer require this step.
rmic Jini versionoffers a more advanced version of RMI in Java. It functions similarly but provides more advanced security, object discovery capabilities, and other mechanisms for distributed object applications. ExampleThe following classes implement a simple client-server program using RMI that displays a message. — listens to RMI requests and implements the interface which is used by the client to invoke remote methods.
import java.rmi.Naming; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.registry.*; public class RmiServer extends UnicastRemoteObject implements RmiServerIntf — defines the interface that is used by the client and implemented by the server.
import java.rmi.Remote; import java.rmi.RemoteException; public interface RmiServerIntf extends Remote — this is the client which gets the reference to the remote object
living on the server and invokes its method to get a message. If the server object implemented java.io.Serializable instead of java.rmi.Remote, it would be serialized and passed to the client as a value. import java.rmi.Naming; public class RmiClient Before running this example, we need to make a 'stub' file for the interface we used. For this task we have the RMI compiler - 'rmic' Note: we make a stub file from the '*.class' file with the implementation of the remote interface, not from the '*.java' file. rmic RmiServer Note that since version 5.0 of J2SE support for dynamically generated stub files has been added, and rmic is only provided for backwards compatibility with earlier runtimes, or for programs that don't provide an explicit port number when exporting remote objects, which is required for generated stubs to be possible, as described in the Javadoc for UnicastRemoteObject. See the comment in the constructor above.
Popular articles UEFA Euro 2020 - The 2020 UEFA European Football Championship , commonly referred to as UEFA Euro 2020 or simply Euro 2020 , is scheduled to be the 16th UEFA European Championship, the quadrennial international me... UEFA European Championship - The UEFA European Football Championship , commonly known as the UEFA European Championship and informally as the Euros , is the primary association football competition contested by the senior men... Cristiano Ronaldo - Portuguese professional footballer who plays as a forward for club Juventus and captains the Portugal national team. Often considered the best player in the ... FIFA World Cup - international association football competition contested by the senior men's national teams of the members of the Fédération Interna... UEFA Euro 2016 - The 2016 UEFA European Football Championship , commonly referred to as UEFA Euro 2016 or simply Euro 2016 , was the 15th UEFA European Championship, the quadrennial international men's football ch... Kylian Mbappé - French professional footballer who plays as a forward for Ligue 1 club Paris Saint-Germain and the France national team. Considered one of the best players in the world, h... Germany national football team - The Germany national football team represents Germany in men's international football and played its first match in 1908. The team is governed by the German Football Association, founded in 1900. Be... Popular movies Cruella (film) - upcoming American crime comedy film directed by Craig Gillespie from a screenplay written by Aline Brosh McKenna, Jez Butterworth, Dana Fox, Kelly Marcel, Tony McNamara, and Steve Ziss... F9 (film) - upcoming American action film directed by Justin Lin and written by Daniel Casey. A sequel to 2017's The Fate of the Furious , it will be the ninth main installment in the Fast & Furious ... A Quiet Place Part II - 2020 American horror film and the sequel to A Quiet Place . The sequel film was written and directed by John Krasinski and stars Emily Blunt, Millicent Simmonds, and Noah... The Conjuring: The Devil Made Me Do It - upcoming American supernatural horror film, directed by Michael Chaves, with a screenplay by David Leslie Johnson-McGoldrick, from a story by Johnson-McG... Gone Girl (film) - 2014 American psychological thriller film directed by David Fincher and with a screenplay by Gillian Flynn based on her 2012 novel of the same title. The film stars Ben Affleck, Rosam... Luca (2021 film) - upcoming 2021 American computer-animated coming-of-age comedy film produced by Walt Disney Pictures and Pixar Animation Studios to be distributed by Walt Disney Studios Motion Pictures. I... Cocktail (1988 film) - 1988 American romantic comedy-drama film directed by Roger Donaldson and written by Heywood Gould, whose screenplay was based on his book of the same name. The film tells the story of ... Popular video games Minecraft - sandbox video game developed by Mojang Studios. Created by Markus "Notch" Persson in the Java programming language and released as a public alpha for personal computers in 2... Elden Ring - collaborative effort between game director Hidetaka Miyazaki a... The Legend of Zelda: Breath of the Wild - is a 2017 action-adventure game developed and published by Nintendo for the Nintendo Switch and Wii U consoles. Breath of the Wild is part of the Legend of Zelda franchise and is set at the end of... Roblox - online game platform and game creation system that allows users to program games and play games created by other users. Founded by David Baszucki and Erik Cassel in 2004 and released in... Shin Megami Tensei V - is an upcoming role-playing video game in development by Atlus. It is part of the Shin Megami Tensei series, itself a part of the larger Megami Tensei franchise, and is scheduled for release on th... Advance Wars - turn-based tactics video game developed for the Game Boy Advance by Intelligent Systems and published by Nintendo. It was released in North America on September 10, 2001 with a lat... Fatal Frame: Maiden of Black Water - survival horror video game developed by Koei Tecmo and published by Nintendo for the Wii U. The fifth main entry in the Fatal Frame series, it was released ... Popular books Nineteen Eighty-Four - dystopian novel by English novelist George Orwell. It was published on 8 June 1949 by Secker & Warburg as Orwell's ninth and final book... Bible - collection of religious texts or scriptures sacred to Christians, Jews, Samaritans, Rastafari and others. They generally consider the Bible to be a product of divine inspiration and a... SCP Foundation - fictional organization documented by the web-based collaborative-fiction project of the same name. Within the website's fictional setting, the SCP Foundation is responsible f... Trese - horror/crime black and white komik created by writer Budjette Tan and artist Kajo Baldisimo. It tells the story of Alexandra Trese, a detective who deals with crimes of supernatural origi... The Education of Little Tree - memoir-style novel written by Asa Earl Carter under the pseudonym Forrest Carter. First published in 1976 by Delacorte Press, it was initially promoted as an authen... Don Quixote - Spanish novel by Miguel de Cervantes. It was published in two parts, in 1605 and 1615. A founding work of Western litera... Romeo and Juliet - tragedy written by William Shakespeare early in his career about two young star-crossed lovers whose deaths ultimately reconcile their feuding families. It was among Shakespear... Popular television series
Loki (TV series) - upcoming American web television miniseries created for Disney+ by Michael Waldron, based on the Marvel Comics character of the same name. It is set in the Marvel Cinematic Universe, shar... Lucifer (TV series) - American urban fantasy television series developed by Tom Kapinos that premiered on Fox on January 25, 2016. It is based on the DC Comics character created by Neil Gaiman, Sam Kieth, a... The Handmaid's Tale (TV series) - American dystopian tragedy web television series created by Bruce Miller, based on the 1985 novel of the same name by Canadian author Margaret Atwood. The series was ordere... Manifest (TV series) - American supernatural drama television series, created by Jeff Rake, that premiered on September 24, 2018, on NBC. The series centers on the passengers and crew of a commercial airlin... Grey's Anatomy - American medical drama television series that premiered on March 27, 2005, on the American Broadcasting Company as a mid-season replacement. The fictional series focuses on the ... Peaky Blinders (TV series) - British period crime drama television series created by Steven Knight. Set in Birmingham, England, the series follows the exploits of the Shelby crime family in the direct afterm... The Walking Dead (TV series) - American post-apocalyptic horror television series for AMC based on the comic book series by Robert Kirkman, Tony Moore, and Charlie Adlard. The series features a large ensemb...
OWIKI.org. Text is available under the Creative Commons Attribution-ShareAlike License.