成果分布式计算chapter5slides_第1页
成果分布式计算chapter5slides_第2页
成果分布式计算chapter5slides_第3页
成果分布式计算chapter5slides_第4页
成果分布式计算chapter5slides_第5页
已阅读5页,还剩13页未读, 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Slides for Chapter 5: Distributed objects and remote invocationFrom Coulouris, Dollimore and KindbergDistributed Systems: Concepts and DesignEdition 4, Addison-Wesley 2005Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Fi

2、gure 5.1Middleware layersApplicationsMiddlewarelayers Request reply protocolExternal data representationOperating SystemRMI, RPC and eventsInstructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.2CORBA IDL example/ In fi

3、le Person.idlstruct Person string name; string place;long year; ;interface PersonList readonly attribute string listname;void addPerson(in Person p) ;void getPerson(in string name, out Person p);long number();Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and D

4、esign Edn. 4 Pearson Education 2005 Figure 5.3Remote and local method invocationsinvocationinvocationremoteinvocationremotelocallocallocalinvocationinvocationABCDEFInstructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.

5、4A remote object and its remote interfaceinterfaceremotem1m2m3m4m5m6Dataimplementationremoteobjectof methodsInstructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.5 Instantiation of remote objects Instructors Guide for

6、Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.6Invocation semanticsFault tolerance measuresInvocation semanticsRetransmit request messageDuplicate filteringRe-execute procedure or retransmit replyNoYesYesNot applicableNoYesNot appli

7、cableRe-execute procedureRetransmit replyAt-most-onceAt-least-onceMaybeInstructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.7The role of proxy and skeleton in remote method invocationobject Aobject BskeletonRequestpro

8、xy for BReplyCommunicationRemote Remote referenceCommunication module modulereference module modulefor Bs class& dispatcherremoteclient serverservantInstructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.8 Role of clien

9、t and server stub procedures in RPC in the context of a procedural languageclient RequestReplyCommunicationCommunication module moduledispatcherservice client stub server stubprocedureprocedureclient process server process procedureprogram Instructors Guide for Coulouris, Dollimore and Kindberg Dist

10、ributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.9Files interface in Sun XDRconst MAX = 1000;typedef int FileIdentifier;typedef int FilePointer;typedef int Length;struct Data int length;char bufferMAX;struct writeargs FileIdentifier f;FilePointer position;Data data;struct

11、readargs FileIdentifier f;FilePointer position;Length length;program FILEREADWRITE version VERSION void WRITE(writeargs)=1;1Data READ(readargs)=2;2 =2; = 9999;Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.10Dea

12、ling room systemDealers computerInformationproviderDealerExternalsourceExternalsourceInformationproviderDealerDealerDealerNotificationNotificationNotificationNotificationNotificationNotificationNotificationNotificationDealers computerDealers computerDealers computerNotificationNotificationInstructor

13、s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.11Architecture for distributed event notificationsubscriberobserverobject of interestEvent serviceobject of interestobject of interestobserversubscribersubscriber3.1.2.notifi

14、cationnotificationnotificationnotificationInstructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.12Java Remote interfaces Shape and ShapeListimport java.rmi.*;import java.util.Vector;public interface Shape extends Remot

15、e int getVersion() throws RemoteException;GraphicalObject getAllState() throws RemoteException;1public interface ShapeList extends Remote Shape newShape(GraphicalObject g) throws RemoteException;2Vector allShapes() throws RemoteException;int getVersion() throws RemoteException;Instructors Guide for

16、Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.13The Naming class of Java RMIregistryvoid rebind (String name, Remote obj) This method is used by a server to register the identifier of a remote object by name, as shown in Figure 15.1

17、3, line 3. void bind (String name, Remote obj) This method can alternatively be used by a server to register a remote object by name, but if the name is already bound to a remote object reference an exception is thrown.void unbind (String name, Remote obj) This method removes a binding.Remote lookup

18、(String name) This method is used by clients to look up a remote object by name, as shown in Figure 15.15 line 1. A remote object reference is returned.String list() This method returns an array of Strings containing the names bound in the registry.Instructors Guide for Coulouris, Dollimore and Kind

19、berg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 2005 Figure 5.14Java class ShapeListServer with main methodimport java.rmi.*;public class ShapeListServerpublic static void main(String args)System.setSecurityManager(new RMISecurityManager(); tryShapeList aShapeList = new ShapeL

20、istServant();1 Naming.rebind(Shape List, aShapeList );2System.out.println(ShapeList server ready); catch(Exception e) System.out.println(ShapeList server main + e.getMessage();Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4 Pearson Education 20

21、05 Figure 5.15Java class ShapeListServant implements interface ShapeListimport java.rmi.*;import java.rmi.server.UnicastRemoteObject;import java.util.Vector;public class ShapeListServant extends UnicastRemoteObject implements ShapeList private Vector theList; / contains the list of Shapes1 private i

22、nt version;public ShapeListServant()throws RemoteException.public Shape newShape(GraphicalObject g) throws RemoteException 2version+; Shape s = new ShapeServant( g, version);3 theList.addElement(s); return s;public Vector allShapes()throws RemoteException. public int getVersion() throws RemoteException . Instructors Guide for Coulouris, Dollimore and Kindberg Distributed System

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论