正在加载图片...
Introduction to RMI client Sample Client Code server MyRemoteobject o =... o.myMethod () remote obiect Note:All of the code in this course has been compiled and tested with JDK 1.2. Release Candidate 1.Please consult the documentation for the version of the JDK that you are using for details on changes for that version. We will start our discussion of distributed object technologies with Java's Remote Method Invocation,which was introduced in Java 1.1. RMI's purpose is to make objects in separate virtual machines look and act like local objects.The virtual machine that calls the remote object is sometimes referred to as a client.Similarly,we refer to the VM that contains the remote as a server. Obtaining a reference for a remote object is a bit different than for local objects,but once you have the reference,you call the remote object just as if it was local as shown in the code snippet.The RMI infrastucture will automatically intercept the request,find the remote object,and dispatch the request remotely. This location transparency even includes garbage collection.In other words, the client doesn't have to do anything special to release the remote object-- the RMI infrastructure and the remote VM handle the garbage collection for you.Introduction to RMI MyRemoteObject o = ...; o.myMethod (); Sample Client Code client server remote object Note: All of the code in this course has been compiled and tested with JDK 1.2, Release Candidate 1. Please consult the documentation for the version of the JDK that you are using for details on changes for that version. We will start our discussion of distributed object technologies with Java's Remote Method Invocation, which was introduced in Java 1.1. RMI's purpose is to make objects in separate virtual machines look and act like local objects. The virtual machine that calls the remote object is sometimes referred to as a client. Similarly, we refer to the VM that contains the remote as a server. Obtaining a reference for a remote object is a bit different than for local objects, but once you have the reference, you call the remote object just as if it was local as shown in the code snippet. The RMI infrastucture will automatically intercept the request, find the remote object, and dispatch the request remotely. This location transparency even includes garbage collection. In other words, the client doesn't have to do anything special to release the remote object -- the RMI infrastructure and the remote VM handle the garbage collection for you
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有