分布式计算原理与应用(Distributed-Computing)第八章课件.ppt
- 【下载声明】
1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
3. 本页资料《分布式计算原理与应用(Distributed-Computing)第八章课件.ppt》由用户(晟晟文业)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 分布式 计算 原理 应用 Distributed Computing 第八 课件
- 资源描述:
-
1、12/20/2022Distributed Computing,M.L.Liu1Advanced Remote Method InvocationsM.L.Liu12/20/2022Distributed Computing,M.L.Liu2RMI Advanced topicsnThe Java RMI API has a rich collection of features.nWe will look at some of RMIs more interesting advanced features,namely:n stub downloadingnsecurity managern
2、client callback.nAlthough these features are not inherent to the distributed object paradigm,they are helpful mechanisms and can be useful to application developers.12/20/2022Distributed Computing,M.L.Liu3The Java RMI ArchitectureC lientServerstubrem ote reference layertransport layerskeletonrem ote
3、 reference layertransport layerl;ogical data pathphysical data pathsupports the interface withthe application programm aps the platform-independent stub/skeletonlayer to the platform-dependent transportlayer;carries out rem ote reference protocolssets up,m aintains,and shuts downconnections;and carr
4、ies out thetransport protocol12/20/2022Distributed Computing,M.L.Liu4Java RMI Client Server InteractionClient hostServer hostRMI registrySomeServer.classSomeInterface_stub.classSomeInterface_skel.classClient.classSomeInterface_stub.class12341.Client looks up the interface object in the RMIregistry o
5、n the server host.2.The RMIRegistry returns a remote reference to the interface object.3.If the interface objects stub is not on the client host and if it is so arranged by the server,the stub is downloaded from an HTTP server.4.Via the server stub,the client process interacts with the skeleton of t
6、he interface object to access the methods in the server object.HTTP hostX12/20/2022Distributed Computing,M.L.Liu5RMI Stub DownloadingnRMI is designed to allow stubs to be made available to the client dynamically.Doing so allows changes to be made in the remote methods without affecting the client pr
7、ogram.nThe stub can be filed with an web server and be downloaded using HTTP.nSecurity measures are needed to prevent both the client side and the server side:nA java security policy file needs to be set on the server host and also on the client host.nA Java Security Manager should be instantiated i
8、n both the client and server programs.12/20/2022Distributed Computing,M.L.Liu6Stub downloadingnIf the stub is to be downloaded from a remote server,transfer the stub class to the appropriate directory on that server,e.g.,www.csc.calpoly.edu/mliu/www,and make sure that the access permission to the fi
9、le is set.nWhen activating the server,specify command options:java -Djava.rmi.serve.codebase=/-Djava.rmi.server.hostname=-Djava.security.policy=where is the URL for the stub class,e.g.,http:/www.csc.calpoly.edu/mliu/class is the name of the host on which the server runs,and specifies where the secur
10、ity policy file for this application is to be found,e.g.,java.security if you have a file by that name in the directory where the server class is.12/20/2022Distributed Computing,M.L.Liu7The java.policy filenThe RMI security manager does not permit network access.The RMI security manager does not per
11、mit network access.Exceptions can be made via the specification in a java.policy file.Exceptions can be made via the specification in a java.policy file.grant grant /permits socket access to all common TCP ports,including the /permits socket access to all common TCP ports,including the defaultdefaul
12、t /RMI registry port(1099)need for both the client and the /RMI registry port(1099)need for both the client and the server.server.permission .SocketPermission permission .SocketPermission *:1024-65535,:1024-65535,connect,accept,resolve;connect,accept,resolve;/permits socket access to port 80,the def
13、ault HTTP port /permits socket access to port 80,the default HTTP port neededneeded /by client to contact an HTTP server for stub downloading /by client to contact an HTTP server for stub downloading permission .SocketPermission permission .SocketPermission *:80,connect;:80,connect;nThis file can be
14、 filed in the same directory as the server class file.This file can be filed in the same directory as the server class file.nWhen activiating When activiating the client,a java.policy file also should be the client,a java.policy file also should be specified:specified:java-Djava.security.policy=java
15、.policy SomeClient java-Djava.security.policy=java.policy SomeClientnSee See http:/ and and http:/ Computing,M.L.Liu8File Placementsjava.policySomeClient.classjava.polcySomeServer.classSomeInterface_stub.classSomeInterface.Skeleton.classSomeInterface_stub.classClient hostclient directoryServer hosts
16、erver directoryHTTP Server12/20/2022Distributed Computing,M.L.Liu9RMI Security ManagernSince RMI involves access to/from a foreign host,and possibly object downloading,it is important for both the server and the client to protect its system from malicious access.nThe RMISecurityManager is a class pr
17、ovided Java,and can be instantiated in both the client and the server for limiting access priviledges.nYou can write your own security manager,if so desired.try System.setSecurityManager(new RMISecurityManager();catch 12/20/2022Distributed Computing,M.L.Liu10Algorithm for building an RMI Application
18、Server side:1.Open a directory for all the files to be generated for this application.2.Specify the remote-server interface,and compile it to generate the interface class file.3.Build the remote server class by implementing the interface,and compile it using javac.4.Use rmic to process the server cl
19、ass to generate a stub.class file and a skelton.class file:rmic SomeServer5.If stub downloading is desired,copy the stub file to an appropriate directory on the HTTP host.6.Activate the RMIRegistry,if it has not already been activated.7.Set up a java.policy file.8.Activate the server,specifying(i)th
20、e codebase if stub downloading is desired,(ii)the server host name,and(iii)the security policy file.12/20/2022Distributed Computing,M.L.Liu11Alogorithm for building an RMI ApplicationClient side:1.Open a directory for all the files to be generated for this application.2.Implement the client program
21、or applet,and compile it to generate the client class.3.If stub downloading is not in effect,copy the server interface stub class file by hand.4.Set up a java.policy file.5.Activate the client,specifying(i)the server host name,and(ii)the security policy file.12/20/2022Distributed Computing,M.L.Liu12
22、RMI Callbacks12/20/2022Distributed Computing,M.L.Liu13IntroductionnIn the client server model,the server is passive:the IPC is initiated by the client;the server waits for the arrival of requests and provides responses.nSome applications require the server to initiate communication upon certain even
23、ts.Examples applications are:n monitoringn gamesn auctioningn voting/pollingn chat-toomn message/bulletin boardn groupware12/20/2022Distributed Computing,M.L.Liu14Polling vs.CallbackIn the absence of callback,a client will have to poll a passive server repeatedly if it needs to be notified that an e
24、vent has occurred at the server end.ServerClient.PollingServerClientCallbackA client issues a request to theserver repeatedly until thedesired response is obtained.A client registers itself with theserver,and wait until the servercalls back.a remote method call12/20/2022Distributed Computing,M.L.Liu
25、15Two-way communicationsnSome applications require that both sides may initiate IPC.nUsing sockets,duplex communication can be achieved by using two sockets on either side.nWith connection-oriented sockets,each side acts as both a client and a server.requestresponserequestresponseProcess 1Process 11
展开阅读全文