JAVA RMI Remote Method Invocation

103 316 0
JAVA RMI  Remote Method Invocation

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

What options do I have for distributed application development? Developers who program using the Java programming language can choose several solutions for creating distributed applications programs. 1) Java RMI technology 2) Java IDL technology (for CORBA programmers) 3) Enterprise JavaBeans technology In this section we shall be talking about Java RMI and IDL (Corba) technologies

Distributed Objects In the Good Old Days Only local objects existed My Machine My Object Today’s World Network and Distributed Objects My Machine Local Objects Remote Machine Remote Objects Overview • What options I have for distributed application development? • Developers who program using the Java programming language can choose several solutions for creating distributed applications programs 1) Java RMI technology 2) Java IDL technology (for CORBA programmers) 3) Enterprise JavaBeans technology In this section we shall be talking about Java RMI and IDL (Corba) technologies JAVA RMI Remote Method Invocation Outline 1) 2) 3) 4) 5) RMI Concepts RMI architecture Implementing and running RMI system Implementing activatable RMI server Summary Introduction • Remote Method Invocation (RMI) technology was first introduced in JDK1.1 • RMI allows programmers to develop distributed Java programs with the same syntax and semantics used for non-distributed programs • RMI is based on a similar, earlier technology for procedural programming called remote procedure call (RPC) Introduction Disadvantages of RPC a) RPC supports a limited set of data types Therefore it is not suitable for passing and returning Java Objects b) RPC requires the programmer to learn a special interface definition language (IDL) to describe the functions that can be invoked remotely Introduction The RMI architecture defines a) How objects behave b) How and when exceptions can occur c) How memory is managed d) How parameters are passed to, and returned from, remote methods The remote object model for Enterprise JavaBeans (EJB) is RMI- based Introduction • • RMI is designed for Java-to-Java distributed applications RMI is simpler and easier to maintain than using socket Other options for creating Java-to-non-Java distributed applications are: a) Java Interface Definition Language (IDL) b) Remote Method Invocation (RMI) over Internet Inter-ORB Protocol (IIOP) RMIIIOP 10 Implementing Event Source Interface Implementing Event Source Interface Implementing Event Source Interface Implementing Event Source Interface Implementing the Listener Interface • implement the TemperatureListener interface, • register itself with the remote temperature sensor service, • client will be notified of changes as they occur, using a remote callback Implementing the Listener Interface Implementing the Listener Interface Implementing the Listener Interface Implementing the Listener Interface Running the Callback Example RMI Components • java.rmi: client-side RMI classes, interfaces, and exceptions • java.rmi.server: server-side RMI classes, interfaces, and exceptions • java.rmi.registry: Classes for naming services • java.rmi.dgc: distribute garbage collection 101 RMI Server Properties • java.rmi.activation: Implements activate on demand RMI services Objects instantiated on-demand by client-requests References persistent over server crashes • rmic: compiler to generate stubs and skeletons • rmiregistry: Utility server that provides naming service for RMI Associates names with objects • rmid: utility server to RMI activation 102 framework RMI Server Properties • java.rmi.server.codebase: a url indicating code base from which classes should be loaded to network clients • java.rmi.server.disableHttp: if true, RMI will not use Http to try to tunnel through firewalls Default is false, meaning that Http wraps RMI calls 103 RMI Server Properties • java.rmi.server.hostname: sets servers fully qualified host name, if name unavailable via DNS • java.rmi.server.logCalls: if true, RMI will log information about calls Default is false • java.rmi.dgc.leaseValue: The time in milliseconds until server notices client is no longer connected Default is 10 minutes 104 RMI Naming Methods • Remote lookup(String name): Look up remote object by URL and return it • bind(String name, Remote obj): bind an object to a specific URL • unbind(String name): unbind an object at a URL • rebind(String name, Remote obj): Replace the object currently bound with a new one • String[] list(String name): list of URL’s from specified Registry 105

Ngày đăng: 18/09/2019, 10:49

Từ khóa liên quan

Mục lục

  • Distributed Objects

  • In the Good Old Days...

  • Today’s World...

  • Overview

  • JAVA RMI

  • Outline

  • Introduction

  • Slide 8

  • Slide 9

  • Slide 10

  • RMI architecture

  • RMI Layer

  • Remote Objects

  • Slide 14

  • Stubs and Skeletons

  • Remote Reference Layer

  • Transport Layer

  • RMI Flow

  • Slide 20

  • Slide 21

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan