Distributed Objects and Remote Invocation - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Distributed Objects and Remote Invocation

Description:

attributes implemented as a pair of get-set-operations ... Java serializes data to include information about the types of its contents, ... – PowerPoint PPT presentation

Number of Views:208
Avg rating:3.0/5.0
Slides: 22
Provided by: jonnei
Category:

less

Transcript and Presenter's Notes

Title: Distributed Objects and Remote Invocation


1
Distributed Objects and Remote Invocation
  • Communication between distributed objects
  • Remote Procedure Call (RPC)
  • Events and notifications
  • Java RMI case study

2
Introduction
  • Middleware
  • "Software that provides a programming model above
    the basic building blocks of processes and
    message passing..." Coulouris2001, p166
  • Interface
  • "...specifies the procedures and the variables
    that can be accessed..." Coulouris2001, p167

3
  • cannot specify direct access to variables
    (different processes can not access each other's
    data)
  • attributes implemented as a pair of
    get-set-operations
  • procedure parameters are input, output or both
  • in difference to local procedure calls
  • no call by value
  • no call by reference
  • no passing of pointers
  • state of the parameter is passed, not the
    parameter or a reference to it

4
Communication between distributed objects
  • remote method call
  • synchronous
  • event-based communication
  • asynchronous
  • transparency
  • calling can be transparent, but interfaces should
    express remoteness
  • Java RMI

5
  • distributed garbage collecting
  • is hard
  • leasing as in Jini
  • client ? stub ? channel ? skeleton ? server

6
Invocation semanticsFailure models
  • Maybe, At-least-once and At-most-once can suffer
    from crash failures when the server containing
    the remote object fails.
  • Maybe - if no reply, the client does not know if
    method was executed or not
  • omission failures if the invocation or result
    message is lost
  • At-least-once - the client gets a result (and the
    method was executed at least once) or an
    exception (no result)
  • arbitrary failures. If the invocation message is
    retransmitted, the remote object may execute the
    method more than once, possibly causing wrong
    values to be stored or returned.
  • if idempotent operations are used, arbitrary
    failures will not occur
  • At-most-once - the client gets a result (and the
    method was executed exactly once) or an exception
    (instead of a result, in which case, the method
    was executed once or not at all)

7
Remote Procedure Call (RPC)
  • client program
  • ? client stub procedure
  • marshall request / unmarshall reply
  • ? client communication module
  • carry out request-reply protocol
  • ? communication channel

8
  • ? server communication module
  • carry out request-reply protocol
  • ? dispatcher
  • choose the server the request belongs to
  • choose the method of a server stub (skeleton) the
    request is passed to
  • ? server stub procedure (skeleton)
  • unmarshall request / call the service procedure /
    marshall reply
  • ? service procedure

9
Events and Notifications
Event service
Picture like in Coulouris2001
10
Events and notifications
  • publish-subscribe
  • event publisher ? event channel ? event
    subscriber
  • pull
  • push
  • systems are heterogeneous and asynchronous

11
  • object of interest
  • event source, publisher, generator
  • event has type and attributes
  • objects representing events are called
    notifications
  • subscriber
  • event sink, listener, subscriber

12
  • observer
  • third-party agent, maybe "channel"
  • roles for observers
  • filter
  • forwarding
  • notification mailboxes
  • events hold until receiver can receive them
  • patterns of events
  • a pattern specifies a relationship between events

13
  • publisher
  • either the object of interest or the observer
  • quality of service

14
Java RMI case study
  • just to show how transparent it is
  • examples do not compile

15
Java RMIas in Coulouris2001
void rebind (String name, Remote obj) This
method is used by a server to register the
identifier of a remote object by name, as shown
in Figure 15.13, line 3. void bind (String
name, Remote obj) This method can alternatively
be used by a server to register a remote object
by name, but if the name is already bound to a
remote object reference an exception is
thrown. void unbind (String name, Remote obj)
This method removes a binding. Remote
lookup(String name) This method is used by
clients to look up a remote object by name, as
shown in Figure 15.15 line 1. A remote object
reference is returned. String list() This
method returns an array of Strings containing the
names bound in the registry.
16
  • import java.rmi.public interface AcmeService
    extends Remote int foo() throws
    RemoteException

17
  • import java.rmi.public class
    AcmeServiceServer public static void
    main(String args) System.setSecurityManager(
    new RMISecurityManager()) try
    AcmeService as new AcmeServiceServant()
    Naming.rebind("Acme Service", as) catch
    (Exception e) // Kids, do not do this at
    home! // Always catch as exact //
    exceptions as possible!

18
  • import java.rmi.import java.rmi.server.Unicast
    RemoteObject
  • public class AcmeServiceServant extends
    UnicastRemoteObjectimplements AcmeService
    public AcmeServiceServant() throws
    RemoteException ... public void foo() throws
    RemoteException ...

19
  • import java.rmi.
  • import java.rmi.server.
  • public class AcmeServiceClient public static
    void main(String args) System.setSecurityMana
    ger( new RMISecurityManager()) try
    AcmeService as (AcmeService)Naming.lookup(
    "//acme.AcmeService") as.foo() catch
    (RemoteException re)
  • catch (Exception e)

20
Summaryas in Coulouris2001
  • Heterogeneity is an important challenge to
    designers
  • Distributed systems must be constructed from a
    variety of different networks, operating systems,
    computer hardware and programming languages.
  • The Internet communication protocols mask the
    difference in networksand middleware can deal
    with the other differences.
  • External data representation and marshalling
  • CORBA marshals data for use by recipients that
    have prior knowledge of the types of its
    components. It uses an IDL specification of the
    data types
  • Java serializes data to include information about
    the types of its contents, allowing the recipient
    to reconstruct it. It uses reflection to do
    this.
  • RMI
  • each object has a (global) remote object
    reference and a remote interface that specifies
    which of its operations can be invoked remotely.
  • local method invocations provide exactly-once
    semantics the best RMI can guarantee is
    at-most-once
  • Middleware components (proxies, skeletons and
    dispatchers) hide details of marshalling, message
    passing and object location from programmers.

21
References
  • Coulouris2001
  • Distributed Systems - Concepts and Design, 3rd
    edition
  • Coulouris, Dollimore, Kindberg
  • Addison Wesley 2001
Write a Comment
User Comments (0)
About PowerShow.com