january 26, 1999--jim waldo copyright 1999 sun microsystems, inc., all rights reserved

27
January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Upload: gordon-allen

Post on 30-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Page 2: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Jini™ Technology: Architecture and Programming ModelJim WaldoSenior Staff Engineer

Sun Microsystems, Inc.

Page 3: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

A New Architecture

• Both hardware and software– Everything is an object– Everything is accessed through an interface

• Network and language centric– Data and code come from the network– The Java™ language is assumed to be everywhere

Page 4: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Philosophy

• Less is more– The simplicity of object-oriented design– RMI extends objects to the network

• Language-based system– Java language forms a conceptual frame– No division between network and

programming types

Page 5: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Unifying Architecture

• Designed for the network– Code and data move, as appropriate– Appropriate for everything

- Devices

- Large servers

- Software

• Everything is an object– Hardware and software are services

Page 6: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Goals of the Jini System

• Enable spontaneous networking– Plug in and join– Unplug and heal

• Provide reliable networks– Individual services more reliable– System independence from any single point of

failure

• Above all, simplicity

Page 7: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Extending the Java PlatformInfrastructure Services

Programming Model

Java VM

RMI

DiscoveryLookup Service

BeansSwing...

EJBJNDIJTS...

JavaSpacesTransaction Manager...

LeasingTransactionsDistributed EventsDistributed Security

Lets objects find and communicate with

each other,

add simple APIs for Remote Objects and

Basic Distributed Computing, and

then everything elseis a service.

Java

Jini

Page 8: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

The Jini Infrastructure

• RMI extends objects to the platform– Allows moving code and data– Merges agent technology with traditional RPC

• Federation through Discovery, Join, and Lookup– Provides the place for services to advertise – Provides the mechanism for finding that place

Page 9: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Service Registration

Jini service Lookup Service

Discovery Request

Discovery ResponseService ProxyObject

Service registration

Page 10: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Service Lookup

Jini client Lookup Service

Discovery Request

Discovery Response

Lookup Request

Service ProxyObject

Lookup Response

Page 11: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Client/Service Interaction

Jini Client Jini Service

Service ProxyObject

Page 12: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Leaving a Jini Federation

• Services can cancel Lookup registration

• A registration lease can run out

• No administer is required

Page 13: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Federation, not Central Control

• Not an operating system

• Defines minimal interaction rules– How to join, rendezvous– Group interaction patterns– All else left to consenting clients and services

• Designed to work with existing OSs

Page 14: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Programming Model

• Three major interfaces– Distributed events– Transactions/two phase commit– Leasing

• Center on interaction patterns

• Define what, not how– All are interfaces– Services implement as best for them

Page 15: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Distributed Events

• Extends AWT/JavaBeans event model– Allows third-party delivery services– Does not assume timely delivery

• Makes use of mobile objects– Notifications can include an object– This object can include behavior– Defers both when and what action is taken in

response to an event

Page 16: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Notification Classpublic class RemoteEvent extends java.util.EventObject{ public RemoteEvent(Object source, long eventID,

long seqNum, MarshalledObject handback);

public Object getSource(); public long getID(); public long getSequenceNumber(); public MarshalledObject getRegistrationObject();}

Page 17: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Remote Listener Interface

public interface RemoteEventListener extends Remote,java.util.EventListener

{void notify(RemoteEvent theEvent)

throws UnknownEventException,RemoteException;

}

Page 18: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Transactions

• Allow multi-object coordination – Standard two-phase commit– No participant implementation guarantees– Designed for a mixed environment– Non-standard semantics supported

• Participant and manager interfaces– Transaction manager presented as a service

Page 19: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Transaction Participant

public interface TransactionParticipantextends Remote, TransactionConstants

{ int prepare(TransactionManager mgr, long id)

throws UnknownTransactionException,RemoteException;

void commit(TransactionManager mgr, long id)throws UnknownTransactionException,

RemoteException; void abort (TransactionManager mgr, long id)

throws UnknownTransactionException,RemoteException;

int prepareAndCommit(transactionmanager mgr, long id)thrrows UnknownTransactionException,

RemoteException;}

Page 20: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Leasing

• Introduces time to resource allocation– Allocation requests for a duration– Grant duration <= request duration

• Leases can be– renewed (granter choice)– cancelled (holder choice)

• Leases can expire

Page 21: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Leasing Interfacepublic interface Lease {

long getExpiration();void cancel() throws UnknownLeaseException,

RemoteException;void renew(long duration)

throws LeaseDeniedException,UnknownLeaseException,RemoteException;

void setSerialFormat (int format);int getSerialFormat();LeaseMap createLeaseMap(long duration);boolean canBatch(Lease lease);

}

Page 22: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Why this model?

• Defines network interactions– Simple– Help in developing reliable distributed

applications– Defines object interactions, not

implementations

Page 23: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Services

• Represented by interfaces– Implement in hardware or software– Implementations can change over time

• Set of services open ended– Devices– Software services– Business objects– etc.

Page 24: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Existing Services

• JavaSpaces– A network object repository– Something between a file and a database

• Transaction manager– Default service implementation– Runs voting protocol

Page 25: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Service Interfaces

• Still to be defined– Network storage– Printing– etc., etc.

• Don’t have to be done by Sun

• Only base types need to be common

Page 26: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

Legacy Services

• Jini requires Java at the network– Services identified by Java type– Proxies may need code downloaded

• Implementation can be non-Java– Wrap legacy language in Java– Make calls to legacy with JNI

• Turns language independence around

Page 27: January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved

January 26, 1999--Jim Waldo Copyright 1999 Sun Microsystems, Inc., all rights reserved.

In Summation

• Simple

• Object-oriented

• Java based

• Network centric

• Service architecture