1 ivan marsic rutgers university lecture 20: distributed computing broker and middleware

Post on 03-Jan-2016

215 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Ivan MarsicRutgers University

LECTURE 20: Distributed ComputingBroker and Middleware

2

Topics

• Middleware• Broker Design Pattern• Java Remote Method Invocation

(RMI)

3

Object Messaging via Middleware

Server ObjectServer Object

Client ObjectClient Object

MiddlewareMiddleware

Message

4

Serialization / Marshalling

• From software objects to a sequence of bits for network transmission

List SorterList SorterClientClient

List

Middleware Middleware

Network

Computer A Computer B

010110011

5

Middleware

• Middleware is a collection of objects that offer a set of services related to object communication, so that extraneous functionality is offloaded to the middleware– To reduce the number of object’s responsibilities

• In general, middleware is software used to make diverse applications work together smoothly

6

Network

Marshaling

Unmarshaling

Middleware

7

Middleware

Object A

Object A

Object B

Object B

Middleware

Object A

Object A

Object B'

Object B'

Object A'

Object A'

Object B

Object B

(a)

(b)

8

Broker Pattern

(a)

(b) Broker

Knowing Responsibilities:•Registry of name-to-reference mappings

Doing Responsibilities:•Maintains the registry and provides lookup•I nstantiates proxies•Network transport of request and result back

Broker

Knowing Responsibilities:•Registry of name-to-reference mappings

Doing Responsibilities:•Maintains the registry and provides lookup•I nstantiates proxies•Network transport of request and result back

MiddlewareBroker component

SSS'S'CC BclientBclient Bserver

Bserver C'C'

ServiceService ServiceService

MiddlewareBroker component

SSS'S'CC BclientBclient Bserver

Bserver C'C'

ServiceService ServiceService

9

Broker Class Diagram

(c)

Client

+ callServer()# useBrokerAPI()

Client

+ callServer()# useBrokerAPI()

«client proxy»Skeleton

+ forwardRequest()# marshal()# unmarshal()

«client proxy»Skeleton

+ forwardRequest()# marshal()# unmarshal()

«server proxy»Stub

+ request()+ forwardResponse()# marshal()# unmarshal()

«server proxy»Stub

+ request()+ forwardResponse()# marshal()# unmarshal()

Broker

+ mainEventLoop()+ registerService()+ forwardRequest()+ forwardResponse()# findServer()# findClient()

Broker

+ mainEventLoop()+ registerService()+ forwardRequest()+ forwardResponse()# findServer()# findClient()

Server

+ initialize()+ mainEventLoop()+ request()# registerService()# useBrokerAPI()

Server

+ initialize()+ mainEventLoop()+ request()# registerService()# useBrokerAPI()

MiddlewareServiceMiddlewareService

10

Client-Server RMI/RPC: Client : Stub : Broker

forwardRequest()

: Skeleton

forwardRequest()

request()

: Server

callServer()

marshal()

findServer()

unmarshal()

request()

response

forwardResponse()

marshal()

forwardResponse()

findClient()

unmarshal()

response

: Client : Stub : Broker

forwardRequest()

: Skeleton

forwardRequest()

request()

: Server

callServer()

marshal()

findServer()

unmarshal()

request()

response

forwardResponse()

marshal()

forwardResponse()

findClient()

unmarshal()

response

11

Java RMI Example

InformantImpl_Stub

+ getAccessHistory()

InformantImpl_Stub

+ getAccessHistory()

InformantImpl

+ getAccessHistory()

InformantImpl

+ getAccessHistory()

Informant

+ getAccessHistory()

Informant

+ getAccessHistory()

ClientClient

Remote UnicastRemoteObject

RemoteRef

12

Practical Issues

1. Do not design for patterns first– Reaching any solution is the priority;

solution optimization should be secondary

2. Refactor the solution to patterns

– E.g., to reduce the complexity of the program’s conditional logic

• Uncritical use of patterns may yield worse solutions!

top related