190 likes | 340 Views
Jini Tutorial. The road to reliable, autonomous distributed systems. Tutorial outline. Three parts, each (hopefully) one hour Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2 Overview of Jini Goals Architecture Basic concepts, protocols Part 3
E N D
Jini Tutorial The road to reliable, autonomous distributed systems
Tutorial outline • Three parts, each (hopefully) one hour • Part 1 Introduction • Distributed systems • Java basics • Remote Method Invocation (RMI) • Part 2 Overview of Jini • Goals • Architecture • Basic concepts, protocols • Part 3 • Jini Programming • Part 4 Advanced topics • Mobile Jini access • Adaptive user interfaces • Security
Characteristics of distributed systems • Different from closed-box systems • The followings are not true • Zero network latency • Networks are reliable • Remote systems fault-free • Infinite bandwidth • One administration • Homogeneous systems • Other problems • Systems can be very large – many components and services • Software deployment problems – packaging and distributing, upgrading
Why Java? • The Java Language has many good design features • secure, safe (with respect to bugs), object-oriented, familiar (to C C++ and even Fortran programmers). • Good set of libraries • networking, multimedia, from graphics to math functions. • Higher programmer productivity • Best available electronic and paper training resources.
Why Java? • Java is rapidly getting the better (the best!) Integrated Development Environments (IDEs) for programs. • Java is naturally integrated with network and universal machine supports potentially powerful “write once-run anywhere” model. • Supports mobile code • Easy to teach, so there is a large and growing trained labour force. • First language in most CS course
Java: Key Technical Ideas • A Better Language: • Simplicity and C/C++ compatibility promote fluency; • GC and Threads allow software components; • Platform independence saves time; • Strong typing catches errors up front; • Declared exceptions forces coverage in code. • Scalable Applications; • Threads for parallel speedup; patterns “in the large”. • Dynamic linking allows simple apps to grow; • Range of implementations from JavaCard through J2ME (mobile) to J2EE (enterprise).
Java program Java API Java Virtual Machine (JVM) Hardware platform The Java Platform • Consists of: • The Java Virtual Machine (Java VM) • The Java Application Programming Interface (Java API) Java platform
The Java Architecture • The Java programming language • interpreted • portable and architecture independent
The role of mobile code • Mobile code enables: • Service provisioning, simple code/service deployment • Device and user specific dynamic user interfaces • Application/service composition on the fly • Summary • Java is good but not enough!
Missing from the Java language • Access to remote JVMs (RMI) • Ad hoc networking and dynamic system configuration (Jini)
Tutorial outline • Part 1 Introduction • Distributed systems • Java basics • Remote Method Invocation (RMI) • Part 2 Overview of Jini • Goals • Architecture • Basic concepts, protocols • Part 3 • Jini Programming • Part 4 Advanced topics • Mobile Jini access • Adaptive user interfaces • Security
Remote Method Invocation (RMI) • Java variant of Remote Method Invocation • Designed for Client-Server applications over unstable and slow networks. • Allows objects running on one JVM invoke methods on an object running on another JVM. • The basic object model of Java does not permit invocations on objects located in remote address spaces • Provides easy access to objects existing on remote virtual machines. RMI extends the basic Java object model beyond a single VM address space. • RMI provides (and hides) communication between remote Java programs. • Fast remote method invocations with low latency and high bandwidth are required for high performance computing.
Java RMI Model cont’d • Objects can be passed as arguments and returned as results remoteObject.someMethod( objectArgument ); • Any Java object can be passed during invocation including primitive types, core classes, user-defined classes and JavaBeans • Syntax of remote method invocation is same as the local invocations • RMI operates only in Java-Java domain, developers work within a single object model instead of working with multiple models • RMI-IIOP to other systems
Client code Basic components HTTP HTTP Client machine Server machine Rmi registry Lookup / download stub skeleton remote server
Required operations in distributed object applications • Register/Locate remote objects: • Obtain references to remote objects . An application can register its remote objects with RMI's simple naming facility, the rmiregistry, or the application can pass and return remote object references as part of its normal operation. • Communicate with remote objects: • Details of communication between remote objects are handled by RMI; to the programmer, remote communication looks like a standard Java method invocation. • Load class bytecodes for objects that are passed around: • Because RMI allows a caller to pass objects to remote objects, RMI provides the necessary mechanisms for loading an object's code, as well as for transmitting its data.
Object Serialization • Provides a programmer the ability to read or write a whole object to and from a raw byte stream. • An essential feature needed by RMI implementation when method arguments are passed by copy.
Development Steps • Design and implement components of distributed application. • Define remote interface – specifies functionality as remote methods. • Implement remote objects – implement the remote interface. • Implement clients. • Compile sources and generate stubs and skeletons. • No skeletons from v1.2 • Put classes in Web accessible directory (HTTP). • Start registry, start application.
Main problem • Static system configuration • Client needs service name/IP address • Makes server/service replication impossible • Difficult to handle errors (network or server) • Solution is Jini