1 / 15

Hirano Object Request Broker

Hirano Object Request Broker. presented by Nikolay Irintchev 12/08/1999. What are distributed objects?

susan
Download Presentation

Hirano Object Request Broker

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hirano Object Request Broker presented by Nikolay Irintchev 12/08/1999

  2. What are distributed objects? • In simple terms, distributed object technology allows objects on different machines to communicate messages (Java method calls) to each other. Here is a simple design of a network karaoke music box model. When song selection is executed for the karaoke box in the server by remote operation, a music object is sent to the client. The client starts the music by sending the message "play."

  3. To define some terms, an object equivalent to the karaoke box is called a "remote object," the music object that is sent to the client is called a "copy object," and the message sent from the client to the karaoke box object in the server is called a "remote message." We will use this model to try to implement a distributed object system.

  4. import java.util.*;class KaraokeBox{ Hashtable musicbox = new Hashtable(); public KaraokeBox(){ for(int i=0;i < 10;i++){ musicbox.put( new Integer(i), new Music(i,"Music" + i)); • } }public void hello(String s){ System.out.println("Client Name " + s);} • public Music getMusic(int select_no){Music music = (Music)musicbox.get(new Integer(select_no));return music; // Return music for specified song selection number}}

  5. public class Music{int no = 0;String title = "";String musicdata = "";final static String[] SOUNDS = {"Tan", "Bom", "Tata", "Ra-ra"};public Music(){}public Music(int no,String title){this.no = no;this.title = title;for(int i=0;i < 8;i++){musicdata += SOUNDS[(int)(Math.random() * 4)] ; // Create song (laugh)}

  6. System.out.println("new .." + title + ": " + musicdata );} • public int getNo(){return no;}public String getTitle(){return title;}public void play(){System.out.println("start --> " + musicdata + " --> stop");}}

  7. import horb.orb.*; • class Client{public static void main(String argv[]){ String name = (argv.length == 1) ? argv[0] : "-";KaraokeBox_Proxy box = new KaraokeBox_Proxy("horb://kinta");box.hello(name);for(int i=0;i < 10;i++){Music m = box.getMusic(i); // Object is copied from serverSystem.out.print("No." + m.getNo() + " [" + m.getTitle() + "] ");m.play();}}}

  8. KaraokeBox_Proxy is called the "proxy object" of KaraokeBox. The actual instance for KaraokeBox is located in the server . The client creates the instance for KaraokeBox_Proxy as the proxy object. Messages to KaraokeBox are sent to the KaraokeBox_Proxy instance. The message is relayed to the KaraokeBox instance through the KaraokeBox_Proxy and the mechanism called KaraokeBox_Skeleton, which is located in the server. The result is then returned to the client. • One of the nice features of HORB is that the KaraokeBox source, which becomes the remote object, does not have to be changed at all.

  9. Object passingPassing an object instance as a remote method parameter, or receiving an object instance from the server as the return value for a remote method, is called "object passing." As an example of this, we will try to call the getMusic() method of KaraokeBox . The client passes the song selection number as a parameter and receives the corresponding music object as the return value.

  10. Remote messagesThe method for sending a remote message after a remote object becomes usable is almost the same for both RMI and HORB. The figure shows hello() method calling and the copying of a String instance (as a parameter in the hello() method) to the server • In this process, the distributed object system turns the String interface into simple stream data and uses the low-level Socket class to send the data to the server. The server returns the String class to its original form. These mechanisms are called "marshalling" and "unmarshalling."

  11. Generation model [HORB, DCOM]The generational model provides the same method as instance creation as object-oriented programming. • KaraokeBox_Proxy box = new KaraokeBox_Proxy("horb://YourHostName"); • Recall that the KaraokeBox instance also is created as a consequence of this execution. In other words, if you use KaraokeBox_Proxy thinking that it is KaraokeBox, a remote object can be created via a method that does not vary from the normal instance generation process in object-oriented programming . • Connection model [CORBA , RMI, HORB, PDO (NEXTSTEP)]The connection model is used to connect to remote objects that were generated earlier by the server. As in the generation model, with the connection model the client does not simply create the KaraokeBox instance. Instead, the object that was created earlier by the server is used.

  12. Designing distributed applications • There are a few points to consider when designing your distributed application. • Clearly indicate the distributed processing targets • Deciding which items to set as remote objects is an important point. Distributed objects are single-memory objects that have been expanded to the network. When designing remote objects, programmers should consider the overhead involved. Specifically, programmers must consider points such as minimizing the network transfer volume in remote processing and making the client and remote object interface as small as possible. In choosing to build a system, in order to create a balanced design, requirements for including distributed objects in the network must be considered.

  13. Use object passing and remote objects properly • Another important point is to use object passing and remote objects properly. Remote objects represent a method of referring to server objects through proxies. For example, in the music object example that was introduced earlier, the processing can be implemented by mounting the music objects as remote objects instead of by using object passing. Only CORBA supports this method. • Object passing allows the programmer to reduce the network communication overhead because the object is copied to the client. Remote objects are better suited for cases in which objects need to access server CPU resources or server data resources directly. From the viewpoint of data consistency, remote objects are preferred when the client only requires some object attributes and all server objects do not have to be copied. Remote objects also are preferred for models in which the server object attributes constantly are changed by server processes.

  14. The goal of distributed object programming • The goal of distributed object programming is to expand object-oriented mechanisms found in single-memory units to the network. The technological concepts for implementing this goal can be arranged into the following three concepts: • 1. Network-permeable object-oriented operation -- Allow objects to be operated with the same methods used in normal object-oriented programming. • 2. Permeability of object locations -- Provide a mechanism that hides the location (server) of objects in the network. • 3. Language-independent, ORB product-independent environment -- Provide an environment that does not depend on a particular language or product.

  15. The first concept, network-permeable object-oriented operation is a concept that is strongly promoted by HORB. However, HORB does not support concepts 2 or 3 above -- permeability of object locations and language-independent, ORB product-independent environments. The HORB concept treats distributed objects as extensions of object orientation. RMI also does not support concepts 2 or 3, whereas • CORBA has focused on technical concepts 2 and 3, which assumes a large-scale, distributed network system. • If nothing else to do go to : • http://www.javaworld.com/javaworld/jw-12-1997/jw-12-horb.html

More Related