A Comparison of Jini and CORBA Andrew See

A Comparison of Jini and CORBA Andrew See Liyuan Yu Zhongying Wang Michael Collins Outline Introduction Motivation Overview Jini Background Design/Implementation

CORBA Background Design/Implementation Comparisons Architectural Ease of use Performance Reusability Comparison Motivation

Middleware is important for distributed computing Jini & CORBA are two solutions Jini & CORBA differ in subtle ways We want to compare Jini and CORBA: Conceptual Architectural Comparison Practical Performance study Reusability of an example system. Overview Game project Develop text based distributed game system

Limited time: no fancy graphics Fair comparison: easy to express in both Jini & CORBA use strings only Variety of games in same network. Use name service of Jini & CORBA Jini Jini Background Embedded hardware is network-centric, not disk-centric Networks are dynamic; so is Jini Object interface; not network protocol Service: A network-accessible device that provides a useful function Client: Any user who requests services

Runtime Architecture Federation of services No central authority Lookup Service Directory of currently available services Services can be searched by clients Execution of services is independent of Jini As backup, Jini also allows network protocol How Jini Works Separation of Interface &

Implementation Services may grant varying access to clients Entire service is downloaded and run locally Service object is a proxy to remote server Methods are remote calls to service, which actually does the work Both local and remote objects share work Separation of Interface & Implementation

Client is not required to know network protocol between proxy & service Service responsible for service object; may communicate using RMI, CORBA, DCOM, etc. Jini Program Design Player One player for all Games Games Separate communication from game specific rules Generalize common game tasks Add/remove a player

Take a turn Update Player state Design Games Interface GameProxy Interface Game Interface RemoteGame BasicGameProxy AbstractGame TurnBasedGame HangmanProxy BlackjackProxy GuessingGame Hangman

Blackjack Design Players Interface Player PlayerImpl (terminal based) GuiPlayer (GUI based) Terminal and GUI based clients have same functionality. Implementation Lease Jini name service

Register GameProxy Server Remote Game GameProxy Lookup Player addPlayer, TakeTurn addPlayer, GameProxy TakeTurn (local processing) Implementation Code samples Creating the server-side object:

Game impl = new GuessingGame(); RemoteGame implProxy = (RemoteGame)exporter.export(impl); Creating the proxy: smartProxy = new BasicGameProxy(implProxy); Registering the proxy: ServiceItem item = new ServiceItem(null, smartProxy, attrs); reg = registrar.register(item, Lease.FOREVER); Implementation Code samples (cont.)

Player taking a turn: Player: protected void takeTurn(String action){ game.takeTurn(action,id); } GameProxy this version just forwards to remote implementation: public void takeTurn(String action, Object id) throws RemoteException { impl.takeTurn(action,id); } player.setGameData(data); The rules for the game could be in the RemoteGame implementation, or the Game Proxy, or split between them. CORBA

What is CORBA? Common Object Request Broker Architecture (CORBA) specification defines a framework for object-oriented distributed applications.. It is an open standard for heterogeneous computing. Allows distributed programs in different languages and different platforms to interact as though they were in a single programming language on one computer Object Request Broker (ORB) A software component that mediates transfer of messages from a program to an object located on a remote host. 0.

Client ORB invocation 0 1 Network ORB 1. Locate CORBA objects and marshal parameters CORBA Object 2 3 5

6 7 Server Invocation ( with an object reference) 4 execution 2. Network Delay 3. Unmarshal parameters 4.

Method Execution 5. Result marshal 6. Network Delay 7. Result unmarshal CORBA Objects and IDL Each CORBA object has a clearly defined interface specified in CORBA interface definition language (IDL).

Distributed objects are identified by object references, which are typed by the IDL interfaces. The interface definition specifies the member functions available to the client without any assumption about the implementation of the object. Example of IDL stockMarket.idl module stockMarket{ interface StockServer { float getStockValue (in string stockName); void setStockValue (in string stockName, in long value); } .. } No Implementation details in IDL Stub and Skeleton

Glue that connects language-independent IDL interface specifications to language specific implementation Client Object Object Stub Client Stub ORB Automatically generated by IDL compiler Design of the Game Project with CORBA Centralized Version:

l ocat e servi ce ret urn server ref erence l ocat e servi ce Nami ng Servi ce ret urn server ref erence Pl ayer1 Pl ayer2 pl ay regi st er Servi ce pl ay Game Server pl ay Two Games:

Guess Game: Two Games (Cont.) HangMan: Design Details--IDL module GameApp{ interface Player { void displayMessage(in string m); string getPlayerID(); }; interface GuessPlayer: Player { }; interface HangmanPlayer: Player { void drawMan(in long numWrong); };

interface Server { void addPlayer(in Player p); void removePlayer(in string playerID); void startGame(in string playerID); void QuitGame(in string playerID); void takeTurn(in string playerID); }; interface GuessServer: Server { void takeTurn(in long number, in string playerID); }; interface HangmanServer: Server { void takeTurn(in char w,in string word, in string playerID); }; }; Design Details--UML

<> GuessPl ayer <> Hangm anPl ayer <> GuessServer <> Hangm anServer +t akeTurn( ) +t akeTur n( ) <> I nterface1 <>

Pl ayer +addPl ayer ( ) +r emovePl ayer( ) +St art Game( ) +Qui t Game( ) +t akeTurn( ) +get Pl ayerI D( ) +di spl ayMessage( ) i mpl ement s Aut omat i cal l y generat ed by I DLt oJ AVA compi l er i mpl ement s J ava I mpl ement at i on Gam eServerI m pl

Pl ayerI m pl +addPl ayer( ) +removePl ayer( ) +St art Game( ) +Qui t Game( ) +t akeTurn( ) +get Pl ayerI D( ) +Di spl ayMessage( ) GuessPl ayer Hangm anPl ayer GuessServerI m pl Hangm anServerI m

pl +DrawMan( ) +t akeTur n( ) +t akeTurn( ) Design of the Game Project with CORBA Decentralized Version play Player1 return server info locate service return server info

Naming Service Player2 locate service register Service Return partner info Create playerlist Game Server Return partner info Design Details-IDL module GameApp { interface Player {

void receiveMessage(in string m); string getPlayerID(); void startGame(in string data); void startNewGame(in string data); void QuitGame(); void response(string number, in string data); void takeTurn(); }; interface Server { string addPlayer(in string p, in string ncRef); }; }; Design Details- UML Interface generated By IDL Compile Implement by programmer

Notes for CORBA decentralized version The server do an only job: to find the partner for each client. This function also can be implemented by Name Service, So server is not essential component. The client need implement all the functions for communicate each other and playing the game Adding more games, or changing the game rules, need to Change class PlayerImpl, which implements main functions for client, and class server, and some minor changes to other classes. Comparison Architectural comparison

Ease of use Performance Reusability Architectural Comparison CORBA used RMI Jini uses anything

rmi, corba, tcp, etc. Jini uses Suns services CORBA uses many ORBs & separate services Jini uses Java only CORBA uses any language + IDL Jini allows pass-by-value and pass-by-reference

pass-by-value uses object serialization pass-by-reference uses RMI CORBA only does pass-by-reference Architectural Comparison Example Events: Jini CORBA

sending event same as a method call to a RemoteEventListener separate EventChannel is used to relay events can be Push based or Pull based. Push and Pull and interoperate Conclusion: Jini is simpler CORBA is more powerful for events Comparison Events Jini: Register Event Source

CORBA: Event Source RemoteEvent Listener notify(RemoteEvent) connect push pull connect Event Channel push pull

RemoteEvent Listener Ease of use Similarities: Registering with name service: Find name server Add binding About the same in Jini & CORBA Looking up a service/object Also

same in Jini & CORBA Error Handling Code needs to deal with possible network problems Ease of use Differences: Networking In CORBA: IDL compiler does all network handling Interfaces are created for building the service In Jini: Programer

needs to make network decisions Often put into configuration files This reflects a difference in philosophy CORBA wants remote objects to look same as local objects Jini wants programmer to deal with network efficiently. Performance Simulated user input driven program: 10 rounds of 100 method calls Jini version downloads code and runs locally Ave. Time w/ Ave. Time w/ lookup o lookup Jini

1958 ms 109 ms CORBA 1163ms 241ms Performance Centralized Guessing game test Not randomized. Played 100 times Time Memory Jini CORBA

User 0.948 2.73s System 0.0625 0.46s Elapsed 4.17 5.98 Player 13MB

49MB Server 13MB 48MB Naming 12MB 54MB Reusability Method:

In both cases little change was needed In CORBA: methods added to IDL game rules modified in Java Networking and book-keeping did not change In Jini: Start with Guessing game

Reuse code to make a new game Abstract classes dealt with networking and book-keeping Subclasses implemented game rules Conclusions: Both Jini and CORBA facilitate reusable code

Recently Viewed Presentations

  • Illinois State University Master Plan Campus Master Plan

    Illinois State University Master Plan Campus Master Plan

    Campus Master Plan Overview of Update Process What is a Campus Master Plan? Long-range plan for physical development of campus Size Form and function Character and image Environment New buildings, renewal of existing facilities, definition of spaces, land use The...
  • Improving ATM Security via Facial Recognition

    Improving ATM Security via Facial Recognition

    Improving ATM Security via Facial Recognition CPSC510 James Maxlow November 25th, 2002 Proposal Cameras in use at automatic teller machines should take still images of users A facial recognition scheme should be added to the software used to verify users...
  • Business Continuity Planning Training Session for Business ...

    Business Continuity Planning Training Session for Business ...

    We plan for vacation, plan for an event, plan our weekly or daily activities. So must we do some pre-thinking when it comes to BUSINESS CONTINUITY PLANNING (BCP). Examples of pre-planning - we take FIRST AID or CPR training in...
  • Le Musée d&#x27;Orsay

    Le Musée d'Orsay

    Le Musée d'Orsay By Erica Titkemeyer La Gare Le Musée d'orsay a été une gare, mais en 1978 il a été fait en Musée. Les trains ont été pris, mais l'horloge sur le mur est restée La Musée Le Peinture...
  • Alternative Sources of Energy - barren.k12.ky.us

    Alternative Sources of Energy - barren.k12.ky.us

    I can describe various forms of energy. Homework: Bring in Poster Board for Wednesday ... Arial Default Design 8th Grade Do Now 09/30/13 Alternative Sources of Energy Nonrenewable vs. Renewable Non-renewable Slide 5 Energy Efficiency and Energy Conservation Energy Efficiency...
  • History - Icsi

    History - Icsi

    Contd. Peer Review means an examination and review of the systems, procedures and practices to determine whether they have been put in place by the practice unit for ensuring the quality of attestation services as envisaged and implied/ mandated by...
  • Computer Networks, 5th Edition Chapter 3 Internetworking Copyright

    Computer Networks, 5th Edition Chapter 3 Internetworking Copyright

    Title: Slide 1 Author: Peter Ashenden Last modified by: Elsevier Created Date: 7/27/2008 10:34:41 PM Document presentation format: On-screen Show Company
  • P08 for J-PARC 50 GeV Proton Synchrotron Pion

    P08 for J-PARC 50 GeV Proton Synchrotron Pion

    P08 for J-PARC 50 GeV Proton Synchrotron Pion double charge exchange on oxygen at J-PARC A.P.Krutenkova ITEP, Moscow, Russia E-mail: [email protected]