TRƯỜNG ĐẠI HỌC NÔNG LÂM : NGUYỄN XUÂN VINH KHOA CÔNG NGHỆ THÔNG TIN. : LẬP TRÌNH MẠNG 2. Remote Method . Presenter: Nguyễn Xuân Vinh. Information Technology Faculty./26. | Java Remote Method Invocation Presenter: Nguyễn Xuân Vinh Information Technology Faculty Nong Lam University “The network is the computer” Consider the following program organization: SomeClass AnotherClass method call returned object computer 1 computer 2 If the network is the computer, we ought to be able to put the two classes on different computers Parameter marshalling Calling the remote getDescription method RMI and other technologies CORBA (Common Object Request Broker Architecture) was used for a long time CORBA supports object transmission between virtually any languages Objects have to be described in IDL (Interface Definition Language), which looks a lot like C++ data definitions CORBA is complex and flaky CORBA has fallen out of favor Microsoft supported CORBA, then COM, now .NET RMI is purely Java-specific Java to Java communications only As a result, RMI is much simpler than CORBA What is needed for RMI Java makes RMI (Remote Method Invocation) fairly easy, but there are some extra steps To send a message to a remote “server object,” The “client object” has to find the object Do this by looking it up in a registry The client object then has to marshal the parameters (prepare them for transmission) Java requires Serializable parameters The server object has to unmarshal its parameters, do its computation, and marshal its response The client object has to unmarshal the response Much of this is done for you by special software Terminology A remote object is an object on another computer The client object is the object making the request (sending a message to the other object) The server object is the object receiving the request As usual, “client” and “server” can easily trade roles (each can make requests of the other) The rmiregistry is a special server that looks up objects by name Hopefully, the name is unique! rmic is a special compiler for creating stub (client) and skeleton (server) classes Processes For RMI, you need to be running three . | Java Remote Method Invocation Presenter: Nguyễn Xuân Vinh Information Technology Faculty Nong Lam University “The network is the computer” Consider the following program organization: SomeClass AnotherClass method call returned object computer 1 computer 2 If the network is the computer, we ought to be able to put the two classes on different computers Parameter marshalling Calling the remote getDescription method RMI and other technologies CORBA (Common Object Request Broker Architecture) was used for a long time CORBA supports object transmission between virtually any languages Objects have to be described in IDL (Interface Definition Language), which looks a lot like C++ data definitions CORBA is complex and flaky CORBA has fallen out of favor Microsoft supported CORBA, then COM, now .NET RMI is purely Java-specific Java to Java communications only As a result, RMI is much simpler than CORBA What is needed for RMI Java makes RMI (Remote Method Invocation) fairly easy, but there are