RMI allows objects to invoke methods on remote objects located in another address space, whether local or remote. This project demonstrates how to create a basic RMI application to check if a number is prime by developing a remote interface, server implementation class, server application, and client application. The communication between client and server objects is handled by stub and skeleton objects. Some advantages of RMI include its ability to pass full objects between systems and move behavior between client and server. Real-time RMI applications include frameworks for distributed real-time systems and embedding spreadsheet functionality into custom applications.
Hybridoma Technology ( Production , Purification , and Application )
Creating a Simple RMI App in Eclipse
1. Creatinga simple REMOTEMETHOD INVOCATION (RMI) applicationinJavausingEclipse IDE. Java
Remote MethodInvocation(RMI) allowsyoutowrite distributedobjectsusingJava.RMIprovidesa
simple anddirectmodel fordistributedcomputationwithJavaobjects.These objectscanbe new
Java objectsorcan be simple JavawrappersaroundanexistingAPI.Javaembracesthe "Write Once,
Run Anywhere model.RMIextendsthe Javamodel tobe run everywhere."Because RMIiscentered
on Java,it bringsthe powerof Java safetyandportabilitytodistributedcomputing.RMIenablesyou
not onlytopass data amongobjectson differentsystemsbutalsotoinvoke methodsinaremote
object.
RMI isan APIwhichallowsanobjectto invoke amethodonan objectthat existsinanotheraddress
space,whichcouldbe on the same machine or on a remote machine.ThroughRMI,objectrunning
ina JVMpresentona computer(Clientside) caninvoke methodsonanobjectpresentinanother
JVM(Serverside).RMIcreatesa publicremote serverobjectthatenablesthe clientandserver-side
communicationsthroughsimple methodcallsonthe serverobject.The communicationbetween
clientandserverishandledbyusingtwointermediate objects:Stubobject(onclientside)and
Skeletonobject(onthe serverside).
Here in thisproject,we will discusshowtodevelopabasic RMI applicationwhichwill tell whether a
numberisPrime or not.Thissimple applicationwill be veryuseful tounderstandthe working of RMI
client and server objects. Here we will discuss the step by step procedures to create an RMI
application.
Prerequisites:
Basic understandingof howtocreate andrun a Java project(applications) inEclipse IDE.
Basic understandingof RMI API.
Basic understandingof Object-OrientedProgramminglogics.
Advantages of RMI APIs:
1. Object Oriented: RMI can pass full objects as arguments and return values, not just
predefineddatatypes.Thismeansthatyou can pass complex types, such as a standard Java
hashtable object,asa single argument.InexistingRPCsystems,you would have to have the
client decompose such an object into primitive data types, ship those data types, and
recreate a hashtable onthe server.RMI letsyoushipobjectsdirectlyacrossthe wire with no
extra client code.
2. Mobile Behaviour:RMI can move behavior(classimplementations) fromclienttoserverand
servertoclient.Forexample,youcandefine aninterface for examining employee expense
reportsto see whethertheyconformtocurrentcompanypolicy.Whenan expense report is
created, an object that implements that interface can be fetched by the client from the
server.Whenthe policieschange,the serverwill startreturninga different implementation
of that interface that uses the new policies. The constraints will, therefore, be checked on
the client side-providing faster feedback to the user and less load on the server without
installing any new software on the user's system. This gives you maximal flexibility since
changing policies requires you to write only one new Java class and install it once on the
server host.
Real-Time Applications of RMI:
2. 1. A Real-Time RMI Framework for the RTSJ: The Real-Time Specification for Java (RTSJ)
providesaplatformforthe developmentof real-time applications. However, the RTSJ does
not take the distribution requirements of real-time applications into consideration. As
distribution in Java is often implemented using Java’s Remote Method Invocation (RMI), a
real-time versionof RMIbetween RTSJ implementations can provide a platform for writing
distributed real-time systems.
2. Integer Spreadsheet by Athena Design: Integer is the most powerful, easiest to use
spreadsheet component for Java. It allows enterprise developers to embed full real-time
spreadsheet functionality into their custom applications with little or no code.
3. IBM San Francisco Project: The San Francisco project is targeted at helping application
developers rapidly build distributed, object-oriented applications. It is doing this by
providing a base set of object-oriented infrastructure and application logic which can be
expanded and enhanced by each developer.
Steps for creating a simple RMI application to find whether a number is prime or not
In this Project will going use Eclipse IDE to create:
Simple Remote Object.
Servertoinstantiate (create) andbindaremote object.
Clienttoinvoke remotelyanobject
The projectstepsthat we coveredinthisprojectare:
1. Create SimpleRMIserverprojectandSimpleRMIclientproject
2. DefiningRemote Interface andImplementationClass
3. Create and Execute ServerApplication
4. Create and execute the clientapplicationprogram
For more detailsplease visit Javainterview questionsforfreshers ourwebsite
SkillPractical providesthe best interview forJavafrombeginnerto expert. TheseJavainterview
questionswill helpthe userstogetgoodknowledge. Some of the interview questions theycover
are:
1. If a variable isdeclaredasprivate,where maythe variable be accessed?
2. What is the differencebetweenSwingandAWT components?
3. How many bitsare usedto representUnicode,ASCII,UTF-16,andUTF-8 characters?
4. Accordingto Java operatorprecedence,whichoperatorisconsideredtobe withhighest
precedence?
5. What is the defaultvalue of floatanddouble datatype inJava?
6. When parseInt() methodcanbe used?
7. What is the major difference betweenjava.util.Dateandjava.sql.Datedatatype?
8. How can we retrieve the file inthe Oracle database?
9. What are the advantagesof JSON overXML?
10. Whichmethodof the componentclassisusedto setthe positionandsize of acomponent?