Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Chapter 12 Intro to Distributed Computing With RMI

Chapter 12 Intro to Distributed Computing With RMI

Ratings: (0)|Views: 225|Likes:
Published by Vinay Singh

More info:

Published by: Vinay Singh on Mar 11, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Chapter 12 Introduction to Distributed Computing with RMI
Distributed Applications
CORBA products provide a framework for the development and execution of 
distributed applications
. But why would one want to develop a distributed applicationin the first place? As you will see later, distribution introduces a whole new set of difficult issues. However, sometimes there is no choice; some applications by their verynature are distributed across multiple computers because of one or more of thefollowing reasons:
used by the application are distributed
is distributed
of the application are distributed
Data are Distributed
Some applications must execute on multiple computers because the data that theapplication must access exist on multiple computers for administrative and ownershipreasons. The owner may permit the data to be accessed remotely but not stored locally.Or perhaps the data cannot be co-located and must exist on multiple heterogeneoussystems for historical reasons.
Computation is Distributed
Some applications execute on multiple computers in order to take advantage of multiple processors computing in parallel to solve some problem. Other applications mayexecute on multiple computers in order to take advantage of some unique feature of a particular system. Distributed applications can take advantage of the scalability andheterogeneity of the distributed system.
Users are Distributed
Some applications execute on multiple computers because users of the applicationcommunicate and interact with each other via the application. Each user executes a piece of the distributed application on his or her computer, and shared objects, typicallyexecute on one or more servers.
Introduction to Distributed Computing with RMI
Remote Method Invocation (RMI) technology, first introduced in JDK 1.1, elevatesnetwork programming to a higher plane. Although RMI is relatively easy to use, it is aremarkably powerful technology and exposes the average Java developer to an entirelynew 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 upgradedunder the Java 2 SDK. Where applicable, the differences between the two releases will be indicated.Information Technology for B.Sc. IT Semester V Page 111
Chapter 12 Introduction to Distributed Computing with RMI
A primary goal for the RMI designers was to allow programmers to develop distributedJava programs with the same syntax and semantics used for non-distributed programs.To do this, they had to carefully map how Java classes and objects work in a single JavaVirtual Machine
(JVM) to a new model of how classes and objects would work in adistributed (multiple JVM) computing environment.This section introduces the RMI architecture from the perspective of the distributed or remote Java objects, and explores their differences through the behavior of local Javaobjects. The RMI architecture defines how objects behave, how and when exceptionscan occur, how memory is managed, and how parameters are passed to, and returnedfrom, remote methods.
Comparison of Distributed and Nondistributed Java Programs
The RMI architects tried to make the use of distributed Java objects similar to usinglocal Java objects. While they succeeded, some important differences are listed in thetable below.Do not worry if you do not understand all of the difference. They will become clear asyou explore the RMI architecture. You can use this table as a reference as you learnabout RMI.Local ObjectRemote ObjectObjectDefinitionA local object is defined by a Java class.A remote object's exported behavior isdefined by an interface that must extend theRemoteinterface.ObjectImplementationA local object isimplemented by its Javaclass.A remote object's behavior is executed by aJava class that implements the remoteinterface.Object CreationA new instance of a localobject is created by thenewoperator.A new instance of a remote object iscreated on the host computer with thenewoperator. A client cannot directly create anew remote object (unless using Java 2Remote Object Activation).Object AccessA local object is accesseddirectly via an objectreference variable.A remote object is accessed via an objectreference variable which points to a proxystub implementation of the remoteinterface.Information Technology for B.Sc. IT Semester V Page 112
Chapter 12 Introduction to Distributed Computing with RMIReferencesIn a single JVM, anobject reference pointsdirectly at an object inthe heap.A "remote reference" is a pointer to a proxyobject (a "stub") in the local heap. Thatstub contains information that allows it toconnect to a remote object, which containsthe implementation of the methods.ActiveReferencesIn a single JVM, anobject is considered"alive" if there is at leastone reference to it.In a distributed environment, remote JVMsmay crash, and network connections may be lost. A remote object is considered tohave an active remote reference to it if ithas been accessed within a certain time period (the lease period). If all remotereferences have been explicitly dropped, or if all remote references have expired leases,then a remote object is available for distributed garbage collection.FinalizationIf an object implementsthe finalize()method, it is called before an objectis reclaimed by thegarbage collector.If a remote object implements theUnreferencedinterface, the unreferencedmethod of that interface is called when allremote references have been dropped.GarbageCollectionWhen all local referencesto an object have beendropped, an object becomes a candidate for garbage collection.The distributed garbage collector workswith the local garbage collector. If there areno remote references and all localreferences to a remote object have beendropped, then it becomes a candidate for garbage collection through the normalmeans.ExceptionsExceptions are eitheRuntime exceptions or Exceptions. The Javacompiler forces a program to handle allExceptions.RMI forces programs to deal with any possibleRemoteExceptionobjects that may be thrown. This was done to ensure therobustness of distributed applications.
Java RMI Architecture
The design goal for the RMI architecture was to create a Java distributed object modelthat integrates naturally into the Java programming language and the local object model.RMI architects have succeeded; creating a system that extends the safety and robustnessof the Java architecture to the distributed computing world.
Interfaces: The Heart of RMI
Information Technology for B.Sc. IT Semester V Page 113

Activity (6)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Arjun Bisht liked this
vander39 liked this
boobus81 liked this
bruno_am liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->