成果分布式計算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

提交評論