Jini and Javaspaces Oikonomou Vassiliki voikonteiath gr Department

  • Slides: 88
Download presentation
Jini and Javaspaces Oikonomou Vassiliki voikon@teiath. gr Department of Informatics Technological Educational Institute of

Jini and Javaspaces Oikonomou Vassiliki voikon@teiath. gr Department of Informatics Technological Educational Institute of Athens Symposium of Innovation of Computer Science Curriculum in Higher Education: Retraining of Young teaching staff February 26, 2004 11/9/2020 Jini & Java. Spaces 1

What is Jini ? n New distributed computing technology n Jini is about networks’

What is Jini ? n New distributed computing technology n Jini is about networks’ ability to change (change is not a rare event - it’s constant) n Jini makes the network an entity that always runs, and may have parts changing as it runs - computers are nowhere - the one computer is everywhere - the system administration is nearly automatic n It follows the telephone network paradigm: an entity, separated from all network-connected pieces, guaranteed to be there all the time Jini & Java. Spaces 11/9/2020 2

What is Jini ? Jini is about services and their users - services live

What is Jini ? Jini is about services and their users - services live on the network - clients look for services - clients access services from the network, not from an entity connected on the network n Participant-to-Participant generation n Plug-and-participate (Microsoft Universal Plug-n-Play -UPn. P) n 11/9/2020 Jini & Java. Spaces 3

Vision and goals for Jini To provide an infrastructure to connect anything, anytime, anywhere

Vision and goals for Jini To provide an infrastructure to connect anything, anytime, anywhere n To provide an infrastructure to enable “network plug and work” n To support a service-based architecture by abstracting the hardware/software distinctions n To provide an architecture to handle partial failure n 11/9/2020 Jini & Java. Spaces 4

Jini on top of Java n Java-technology centered: bytecode everywhere - other languages may

Jini on top of Java n Java-technology centered: bytecode everywhere - other languages may be compiled to bytecode n Jini is tightly coupled with Java as an application environment and a programming model n Jini is not coupled with Java as a language. – This means that the service can be implemented in any language: C, C++, or JPython. But to participate in the architecture, it should be subjected to a compiler that can produce Java-compliant byte code. If not, it can be Java wrapped/Java-tized using Java native interface (JNI). In this way, even a legacy application can be Java-wrapped and can be made into a Jini service. To summarize: Jini architecture is not Java language-centric but Java application-centric 11/9/2020 Jini & Java. Spaces 5

Jini on top of Java n n n Java Serialization Java RMI Java Security

Jini on top of Java n n n Java Serialization Java RMI Java Security 11/9/2020 Jini & Java. Spaces 6

Jini on top of Java 11/9/2020 Jini & Java. Spaces 7

Jini on top of Java 11/9/2020 Jini & Java. Spaces 7

11/9/2020 Jini & Java. Spaces 8

11/9/2020 Jini & Java. Spaces 8

11/9/2020 Jini & Java. Spaces 9

11/9/2020 Jini & Java. Spaces 9

11/9/2020 Jini & Java. Spaces 10

11/9/2020 Jini & Java. Spaces 10

Services n n A service is an entity that may be used by a

Services n n A service is an entity that may be used by a person, a program or another service A service may be a device, a piece of software or a collection of other services Groups of Jini services join together in cooperating sets (the communities) Jini allows creating a federation of services Federation is the ability for Jini communities to be linked together, or federated, into larger groups (Jini addresses scalability through federation). 11/9/2020 Jini & Java. Spaces 11

Federation n A federation of services is a set of services, currently available on

Federation n A federation of services is a set of services, currently available on the network, that a client can bring together to help it accomplish some goal. n Federating groups of devices and software components into single distributed system Members of federation agree on basic notions of trust, administration, identification and policy Members of federation communicate through a set of Java interfaces (service protocol) and locate each other using a special lookup service It’s possible to federate Jini systems for larger organizations n n n 11/9/2020 Jini & Java. Spaces 12

Services n Services represented by Java Interfaces – Separation of “what the service does”

Services n Services represented by Java Interfaces – Separation of “what the service does” from “how the service is implemented” – Only contract between service provider and service user – Jini. org community effort defines commonly agreed -upon Jini service interface types n Client Finds Service by Interface 11/9/2020 Jini & Java. Spaces 13

Service Interfaces n Community driven – Printing – Service UI n Only base types

Service Interfaces n Community driven – Printing – Service UI n Only base types need to be common – Vendors compete in implementation – Vendors can extend the interface n Interfaces can evolve – New apps can use new functionalities – Old apps still work 11/9/2020 Jini & Java. Spaces 14

Jini Service Architecture Service is defined by one or more Java interfaces n Service

Jini Service Architecture Service is defined by one or more Java interfaces n Service has a service proxy object n – Local – RMI stub – Smart proxy Proxy implements Java interfaces n Clients only know about Java interfaces n Proxy object is downloaded to clients n 11/9/2020 Jini & Java. Spaces 15

From network protocols to object interfaces 11/9/2020 Jini & Java. Spaces 16

From network protocols to object interfaces 11/9/2020 Jini & Java. Spaces 16

Devices - gadget revolution n n Devices have some memory & processing power (cell

Devices - gadget revolution n n Devices have some memory & processing power (cell phones, smart cards, PDAs …) - They can run Java 2 Micro Edition (J 2 ME) or Personal Java Devices with no JVM (very limited or no processing power but a small amount of I/O capability) -Proxies provided for “dumb” devices : Surrogate solution -A Jini proxy is a machine capable of running a JVM attached to one or more cheap or non-Java devices 11/9/2020 Jini & Java. Spaces 17

The Jini System Architecture n Jini infrastructure: – Discovery Protocol – Join Protocol –

The Jini System Architecture n Jini infrastructure: – Discovery Protocol – Join Protocol – Lookup Service n Jini services: – Java. Spaces – Transaction Manager n Programming Model – Leasing, Transactions, Distributed Events 11/9/2020 Jini & Java. Spaces 18

Jini infrastructure u Discovery Protocol Join Protocol u Lookup Service u 11/9/2020 Jini &

Jini infrastructure u Discovery Protocol Join Protocol u Lookup Service u 11/9/2020 Jini & Java. Spaces 19

A service makes itself available through Jini n When we plug in a service

A service makes itself available through Jini n When we plug in a service to the network, it gets an IP address (automatically done via DHCP) n The service discovers at least one Lookup Service using - multicast discovery or - unicast discovery n The service registers with each Lookup Service discovered (Join Protocol) it writes a proxy object that clients can download to use the service - 11/9/2020 Jini & Java. Spaces 20

Service Requester Requesting Service within Jini Community n Any client (service requester) needing a

Service Requester Requesting Service within Jini Community n Any client (service requester) needing a service joins the community using the discovery protocol. In that process it locates one or more Lookup Services within the community. n After locating a Lookup Service, the client looks for the service in the Lookup Service based on its service type (Java interfaces). n Once the service is found, the client invokes the service, which involves moving the proxy code on to the client. Now the client can perform any operation on the service by calling its methods. n Once the service proxy is downloaded, a service requester, depending upon its requirements, creates, negotiates, or terminates its lease with the service provider 11/9/2020 Jini & Java. Spaces 21

Discovery Protocols n The discovery protocols allow three different types of interaction. – Service-initiated

Discovery Protocols n The discovery protocols allow three different types of interaction. – Service-initiated requests for lookup services (multicast request protocol ). – Lookup Service-initiated announcements to other services (multicast announcement protocol). – Direct pairings between Lookup Services and other Jini services (unicast discovery protocol). 11/9/2020 Jini & Java. Spaces 22

The Multicast Request Protocol n The multicast request protocol is a service-initiated protocol that

The Multicast Request Protocol n The multicast request protocol is a service-initiated protocol that is used when a service needs to discover all the Lookup Services that may already exist on a local network. The protocol is implemented using a low-level multicast facility, so it does not require fullfledged Java RMI or CORBA or any other more heavyweight protocol. If, as is usually the case, the multicast request protocol is being run in a standard TCP/IP setting, then multicast UDP datagrams are used as the basis for the protocol. 11/9/2020 Jini & Java. Spaces 23

The Multicast Announcement Protocol n The multicast announcement protocol is used by Lookup Services

The Multicast Announcement Protocol n The multicast announcement protocol is used by Lookup Services to announce their presence to any interested parties that may be listening and "in range" of the multicast scope of the lookup service. Unlike multicast request, which typically only is used during the start up phase of a service or when the set of groups it wishes to be a member of changes, multicast announcement is used for the duration of the life of a Lookup Service. It will periodically announce its existence to any parties that may care to listen 11/9/2020 Jini & Java. Spaces 24

The Unicast Discovery Protocol n In addition to listening on a multicast address for

The Unicast Discovery Protocol n In addition to listening on a multicast address for multicast discovery requests from services, each Lookup Service also listens on a normal, unicast address. This protocol is called the unicast discovery protocol. Any service can connect directly to this address to access the lookup service. In this sense, the protocol isn't so much a "discovery" protocol, as a way to contact an already known lookup service in order to download its service proxy. The client sends a message to the Lookup Service, which replies with its service proxy. n Unicast discovery is based on a URL naming scheme, where lookup services are named using URLs of the form jini: //turbodog. parc. xerox. com: 4160/foobar. n Unicast discovery protocol – Allows communication with a specific Lookup Service – Used to connect a Lookup Service in WAN 11/9/2020 Jini & Java. Spaces 25

The Unicast Discovery Protocol n Unicast discovery is also used during the course of

The Unicast Discovery Protocol n Unicast discovery is also used during the course of the two multicast protocols. n When multicast request runs, the service proxy is delivered using the lookup service-to-discoverer half of the unicast discovery protocol. n And in multicast announcement, once a discoverer has been made aware of a lookup service, it requests its service proxy using unicast discovery. 11/9/2020 Jini & Java. Spaces 26

Lookup Service n Sun supplies a Lookup Service called Reggie as part of the

Lookup Service n Sun supplies a Lookup Service called Reggie as part of the standard Jini distribution n n Lookup Service is a repository of Jini services Lookup Service maintains flat collection of service items n Items contain: – the Service. ID (a globally unique identifier for the service). – the service proxy (or stub) object – an extensible collection of descriptive attributes: type of the service, service location, provider etc. (Attributes allow further discrimination between services of the same type) 11/9/2020 Jini & Java. Spaces 27

Lookup Service n For any service registration the Lookup Service returns a Service. Registration

Lookup Service n For any service registration the Lookup Service returns a Service. Registration object which provides lot useful information about registration: - a method to get the related Lease object - a method to get the allotted Service. ID - a set of methods to add/modify/replace with new bunch of attributes 11/9/2020 Jini & Java. Spaces 28

Service Item Service Object. The actual service is provided by this object Service Attributes

Service Item Service Object. The actual service is provided by this object Service Attributes Name Location Type Service. ID Null if this is a new Service. Item to be registered with the lookup service. 11/9/2020 Organization A valid Service. ID that represents an existing service item on the lookup. If you have already registered the service and are now attempting to change some attributes of the service, you have to provide the old Service. ID. Jini & Java. Spaces 29

Lookup Operation n n A client performs a lookup operation by building a Service

Lookup Operation n n A client performs a lookup operation by building a Service Template A template is made of: – service type and/or – attribute sets and/or – Service. ID 11/9/2020 Jini & Java. Spaces 30

Service Template 11/9/2020 Jini & Java. Spaces 31

Service Template 11/9/2020 Jini & Java. Spaces 31

Service Proxy n Implementation of the Jini service’s Java interface type – Preserves Service

Service Proxy n Implementation of the Jini service’s Java interface type – Preserves Service Java interface type n n Contains everything that a client needs in order to use the service – GUI – On-the-wire-protocol implementation – Device driver functionality Proxy object is downloaded to clients 11/9/2020 Jini & Java. Spaces 32

Proxy Implementation Form n n Local object (Serialized form) – The whole service object

Proxy Implementation Form n n Local object (Serialized form) – The whole service object is serialized into a proxy (and therefore, calling it a “proxy” is really unfair). This strategy is used when the service is implemented purely in software, and there are no external resources that need to be used. An example might be a language translation service that is completely implemented as in Java code and has no need to talk to any external processes to do its job. Remote object – RMI stub is serialized into a proxy. In this case, the proxy is a minimal, automatically-generated bit of code that has only the “intelligence” necessary to speak RMI 11/9/2020 Jini & Java. Spaces 33

Proxy Implementation Form n n n Mixed (Smart proxy) – Combination of local object

Proxy Implementation Form n n n Mixed (Smart proxy) – Combination of local object and remote object – The proxy contains local methods as well as calls to remote object Smart proxy (as opposed to an automatically generated RMI stub) allows more processing to be embedded in the client and it fully hides the details of the communications protocol from him Smart proxies can be used to provide a Jini interface to legacy (non-Java) services that speak sockets or CORBA or some other protocol, and they can provide access to hardware devices that have their own communications protocols. 11/9/2020 Jini & Java. Spaces 34

11/9/2020 Jini & Java. Spaces 35

11/9/2020 Jini & Java. Spaces 35

11/9/2020 Jini & Java. Spaces 36

11/9/2020 Jini & Java. Spaces 36

11/9/2020 Jini & Java. Spaces 37

11/9/2020 Jini & Java. Spaces 37

11/9/2020 Jini & Java. Spaces 38

11/9/2020 Jini & Java. Spaces 38

HTTP server n The proxy passes through one JVM in ``passive'' form and is

HTTP server n The proxy passes through one JVM in ``passive'' form and is activated ( brought to life) in the client's JVM. Essentially, a ``snapshot'' of the object's state is taken using serialization, and this snaphot is moved around. An object consists of both code and data, and it cannot be reconstituted from just its data - the code is also required. Where is the code? This is where a distributed Jini application differs from an ordinary one: the code is not likely to be on the client side. If it was required to be on the client side, then Jini would lose almost all of its flexibility because it wouldn't be possible to just add new devices and their code to a network. The class definitions are most likely on the server, or perhaps on the vendor's home Web site. Jini & Java. Spaces 11/9/2020 39

HTTP server n n Class definitions must also be downloaded, usually from where the

HTTP server n n Class definitions must also be downloaded, usually from where the service came from. This could be done using a variety of methods, but most commonly an HTTP or FTP protocol is used. The service specifies the protocol used and also the location of the class files using the java. rmi. server. codebase property. The object's serialized data contains this codebase, which is used by the client to access the class files. If the codebase specifies an HTTP url, then there must be an HTTP server running at that url, and the class files must be there also. This often means one HTTP server per service, but this isn't required: a set of services could make their class files available from a single HTTP server, and this server could be running on a different machine to the services. 11/9/2020 Jini & Java. Spaces 40

Programming model Distributed Leasing n Distributed Events n Distributed Transactions n 11/9/2020 Jini &

Programming model Distributed Leasing n Distributed Events n Distributed Transactions n 11/9/2020 Jini & Java. Spaces 41

What & Why Leasing? n n Lease is a grant to use a resource

What & Why Leasing? n n Lease is a grant to use a resource for a certain period of time Handles intrinsic unreliability in a distributed computing – Partial failure, Slow connection Solves problems of traditional distributed systems – Resources never freed – Services delivered long after the request – Unbounded resource consumption Provides extra benefits – Resource management 11/9/2020 Jini & Java. Spaces 42

Distributed Leasing Jini uses distributed leasing to help create a selfhealing network: it is

Distributed Leasing Jini uses distributed leasing to help create a selfhealing network: it is always reflecting the current status of all the available services without any human administration! n All services are leased based on time n Lease time may be absolute or durational n Leases can be exclusive or they can allow multiple requesting services connect to a given service n 11/9/2020 Jini & Java. Spaces 43

Lease Operations n Jini provides a simple interface for requesting, renewing and canceling a

Lease Operations n Jini provides a simple interface for requesting, renewing and canceling a lease – Leases may be: » Cancelled (explicit cleanup) » Renewed (explicit extension) » Allowed to expire (implicit cleanup) » Obtained and manipulated by third parties 11/9/2020 Jini & Java. Spaces 44

Lease times The shorter the lease times, the more current the network snapshot (a

Lease times The shorter the lease times, the more current the network snapshot (a really up-to-date network) and the less likely it’ll be that a client selects a service that’s no longer available. n On the other hand, the shorter the lease times, everybody is spending all of their cycles and bandwidth renewing leases! n So, there is a tradeoff. It really depends on the type of service n 11/9/2020 Jini & Java. Spaces 45

Characteristics of Leasing Lease period granted cannot be more than what is requested n

Characteristics of Leasing Lease period granted cannot be more than what is requested n Lease granting policy is service specific n – Lease duration allocation – Lease renewal n Client behavior when it cannot access leased resource is client implementation specific – A well-behaving client would retry 11/9/2020 Jini & Java. Spaces 46

Things that can be Leased n n n Anything that can be considered as

Things that can be Leased n n n Anything that can be considered as resource Usage of server resource – Service registrations maintained by Lookup Service – Transactions maintained by Transaction Manager – Event registrations maintained by Event Generator Persistent storage – File system, Java. Space 11/9/2020 Jini & Java. Spaces 47

Distributed Events n The distributed event model is an extension of the system used

Distributed Events n The distributed event model is an extension of the system used in Java. Beans. n An event is a notification system for the services to indicate that an action is to be taken. The distributed event mechanism requires that Jini services register with others to receive notification. The Jini system handles the task of locating the services according to the hierarchy. n The involving objects: event source or generator, event listener, third party objects acting as filters/proxies (event adaptors) 11/9/2020 Jini & Java. Spaces 48

Distributed Events n n n Network delivery is unreliable: messages may be lost. Synchronous

Distributed Events n n n Network delivery is unreliable: messages may be lost. Synchronous methods requiring a reply may not work here Network delivery is time-dependent: messages may arrive at different times to different listeners. So the state of an object as perceived by a listener at any time may be inconsistent with the state perceived by others. Passing complex object state across the network may be more complex to manage than passing simpler information A remote listener may have disappeared by the time the event occurs. Listeners have to be allowed to ``time out'', like services do. 11/9/2020 Jini & Java. Spaces 49

Distributed Events n Jini makes no assumptions about guarantees of delivery, and does not

Distributed Events n Jini makes no assumptions about guarantees of delivery, and does not even assume that events are delivered in order. The Jini event mechanism does not specify how events get from producer to listener - it could be by RMI calls, but may be through an unreliable third party (event adaptors): – Store -and-forward agents (offload generator object) – Notification Filters (offload receivers) – Notification Mailboxes (offline receipt) 11/9/2020 Jini & Java. Spaces 50

Distributed Transactions n n A transaction is a set of operations to be performed

Distributed Transactions n n A transaction is a set of operations to be performed as a single unit Jini transaction model – Designed for distributed coordination – Standard two-phase commit – Light-weight, object oriented » Compared to Transaction Monitor » Each participant is responsible for upholding ACID properties (Atomic, Consistency, Isolation, Durability) 11/9/2020 Jini & Java. Spaces 51

Distributed Transactions n This transaction system is based on the common two-phased commit model.

Distributed Transactions n This transaction system is based on the common two-phased commit model. The system keeps records of the transaction environment before and after the transaction is processed so that it can be undone if necessary. The standard, however, does not indicate how this transaction system is implemented; that is left to the developer implementing the individual services. 11/9/2020 Jini & Java. Spaces 52

Distributed Transactions n n n Transaction Manager – Provided as Jini infrastructure service –

Distributed Transactions n n n Transaction Manager – Provided as Jini infrastructure service – Implements Transaction. Manager interface – Coordinates two-phase commit operations Transaction Participant – Implements Transaction. Participant – Performs operations under a transaction Transaction Client – Asks Transaction manager to create a transaction – Passes the transaction to transaction participants 11/9/2020 Jini & Java. Spaces 53

Transaction Manager n Service interface net. jini. core. transaction. server. Transaction. Manager n RMI-based

Transaction Manager n Service interface net. jini. core. transaction. server. Transaction. Manager n RMI-based service implementation com. sun. jini. mahalo. Txn. Manager. Impl n Proxy class (RMI stub) com. sun. jini. mahalo. Txn. Manager. Impl_Stub n Client only knows about net. jini. core. transaction. server. Transaction Manager interface n Mahalo: Sun’s implementation of Transaction Manager specification 11/9/2020 Jini & Java. Spaces 54

Jini Benefits n n n Design to the interface Services interact without preinstalled drivers

Jini Benefits n n n Design to the interface Services interact without preinstalled drivers Self-healing nature - no need to reconfigure upon failure Clean up is automatic - garbage collection is eliminated Change vendors at any time Modify equipment configurations easily, including legacy hardware and software 11/9/2020 Jini & Java. Spaces 55

Open Issues Security n Installation difficulties n – New IDE : Inca. X (Java

Open Issues Security n Installation difficulties n – New IDE : Inca. X (Java v 1. 4 & Jini 2. 0) n Adoption by device manufacturers – Surrogate Solution n Licenses 11/9/2020 Jini & Java. Spaces 56

Jeri n Jeri stands for "Jini Extensible Remote Invocation". It supports the standard RMI

Jeri n Jeri stands for "Jini Extensible Remote Invocation". It supports the standard RMI semantics but is designed to be more flexible than existing RMI implementations such as JRMP and RMIover-IIOP. It can support – The new Jini trust model – Elimination of the compile-time generation of stubs – Non-TCP transports – More flexible distributed garbage collection – Much greater customization 11/9/2020 Jini & Java. Spaces 57

Motivations of Surrogate Architecture Accommodate constrained devices or software entities into Jini federation n

Motivations of Surrogate Architecture Accommodate constrained devices or software entities into Jini federation n Accommodate devices running over different network types into Jini federation n – IEEE 1394, Bluetooth n With well-defined architectural framework – Devices can work with 3 rd-party provided surrogate host 11/9/2020 Jini & Java. Spaces 58

11/9/2020 Jini & Java. Spaces 59

11/9/2020 Jini & Java. Spaces 59

Surrogate Architecture: Components n Device – Hardware or software entities that are not capable

Surrogate Architecture: Components n Device – Hardware or software entities that are not capable of directly participating in a Jini network n Surrogate – Java object that represents a device – Participates in Jini network as Jini service, client, or both 11/9/2020 Jini & Java. Spaces 60

Surrogate Architecture: Components n Surrogate host – Provides Java and Jini execution environment for

Surrogate Architecture: Components n Surrogate host – Provides Java and Jini execution environment for surrogates – Connected to both Jini network and Interconnect – Handles life-cycle management of surrogates n Host-capable machine 11/9/2020 Jini & Java. Spaces 61

Surrogate Architecture: Components n Interconnect – Logical and physical connection between surrogate host and

Surrogate Architecture: Components n Interconnect – Logical and physical connection between surrogate host and device – Interconnect protocol » Interconnect-specific mechanisms for discovery, retrieval of surrogate, and liveness n Export server – Exports resources 11/9/2020 Jini & Java. Spaces 62

Java. Space - A Jini service Provides functionality to other Jini services and clients

Java. Space - A Jini service Provides functionality to other Jini services and clients n It makes itself available through the Jini lookup mechanisms n Use the Jini programming models: n – Transactions (as a transaction participant) – Leases (as a lease grantor) – Events (as an event generator) 11/9/2020 Jini & Java. Spaces 63

Java. Space - A Jini service n Service interface – net. jini. space. Java.

Java. Space - A Jini service n Service interface – net. jini. space. Java. Space n RMI-based service implementation – com. sun. jini. outrigger. Front. End. Space n Proxy object (smart proxy) – com. sun. jini. outrigger. Space. Proxy n Client only knows about – net. jini. space. Java. Space interface 11/9/2020 Jini & Java. Spaces 64

What is a Java. Space? n Helps to solve two problems distributed persistence and

What is a Java. Space? n Helps to solve two problems distributed persistence and the design of distributed algorithms (specification). n Provides shared, network-accessible repository for objects – Processes use the repository as a persistent object storage and exchange mechanism Provides loosely-coupled communication among processes – No need to know who (a particular process), where (on a particular machine), when (at a particular time) to send a message or invoke a method – Write an object into a space with the expectation that someone, somewhere, at some time, will take the object n 11/9/2020 Jini & Java. Spaces 65

What is a Java. Space? n Departure from conventional distributed system – No “passing

What is a Java. Space? n Departure from conventional distributed system – No “passing messages directly between processes” – No “invoking methods on remote objects” n Views an application as a collection of processes cooperating via flow of objects into and out of one or more spaces 11/9/2020 Jini & Java. Spaces 66

Java. Spaces - Entries n n n A Space (Java. Space instance) holds entries

Java. Spaces - Entries n n n A Space (Java. Space instance) holds entries An entry is a typed group of objects (called fields), expressed by a class in the Java programming language. That implements the interface space. entry. Objects are stored as implementation specific representations, with the serialized class and fields 11/9/2020 Jini & Java. Spaces 67

Java. Spaces - Entries n n Entries written to/from Java. Space with “write, read,

Java. Spaces - Entries n n Entries written to/from Java. Space with “write, read, take” “notify” is only invoked for committed writes Entries are written with a “lease”, persistence is subject on renewal in order to reduce garbage after failures Pattern Matching done to templates with class type comparisons, no comparison of literals. Exact match or don’t care – Templates match entries iff each field in template is either null or match the entry field via Marshalled. Object. equals. This occurs when the serialized forms of the objects match exactly. 11/9/2020 Jini & Java. Spaces 68

Entry Serialization n Serialization occurs – before an entry is transmitted to space during

Entry Serialization n Serialization occurs – before an entry is transmitted to space during write() – before a template is transmitted to space during read(), take(), notify(), – snapshot() n Deserialization occurs – after an entry is retrieved from the space -during read(), take() 11/9/2020 Jini & Java. Spaces 69

Java. Space Mechanisms n n n Each Java. Space server exports an object that

Java. Space Mechanisms n n n Each Java. Space server exports an object that implements the JS interface locally on the client, and communicates through an implementation specific interface All operations are invoked on a local smart proxy for the space. The actual implementation for the space can reside on the same machine or on a remote machine. RMI is used for communication between the local space object and the service. Multiple Java. Spaces cooperate, and transactions span multiple spaces. Partitions provide minimal protection. A Java. Space’s implementation is not a relational or object database 11/9/2020 Jini & Java. Spaces 70

11/9/2020 Jini & Java. Spaces 71

11/9/2020 Jini & Java. Spaces 71

11/9/2020 Jini & Java. Spaces 72

11/9/2020 Jini & Java. Spaces 72

Multiple Spaces cooperate 11/9/2020 Jini & Java. Spaces 73

Multiple Spaces cooperate 11/9/2020 Jini & Java. Spaces 73

Java. Space Model Identities Client read write Client write. Event Transaction notify write take

Java. Space Model Identities Client read write Client write. Event Transaction notify write take write Java. Space 11/9/2020 Java. Space Event Catcher notify Java. Space Jini & Java. Spaces 74

11/9/2020 Jini & Java. Spaces 75

11/9/2020 Jini & Java. Spaces 75

Outrigger n Sun’s first implementation of Java. Spaces specification n Has two implementations –

Outrigger n Sun’s first implementation of Java. Spaces specification n Has two implementations – Transient. Space » Does not support persistence » Extends Unicast. Remote. Object » Stored in transient-outrigger. jar – Front. End. Space » » » Supports persistence Uses object database (ODI PSE Pro) as persistent storage Extends Activatable Stored in outrigger. jar Must specify a directory name to contain database 11/9/2020 Jini & Java. Spaces 76

Uses of Javaspaces n Information Sharing – in chat or messaging systems (the space

Uses of Javaspaces n Information Sharing – in chat or messaging systems (the space is used as the shared message board that clients can write to and then extract messages from) Compute Serving n Work Flow n 11/9/2020 Jini & Java. Spaces 77

A space-based compute server Worker take Worker write Task Result take Task Worker write

A space-based compute server Worker take Worker write Task Result take Task Worker write Result Java Space 11/9/2020 take write Master Jini & Java. Spaces 78

A space-based compute server n n The problem is one that can be split

A space-based compute server n n The problem is one that can be split into parallel tasks The Master produces chunks of the problem and send them to a Java. Space Workers of that space running on separate machines consume the chunks, perform the computation and return the completed chunks to the Java. Space The Master takes the completed chunks from the space and assembles them 11/9/2020 Jini & Java. Spaces 79

A space-based compute server 11/9/2020 Jini & Java. Spaces 80

A space-based compute server 11/9/2020 Jini & Java. Spaces 80

Java. Spaces/Jini n n n The “other” strategic ubiquitous Java model (contrast to EJB)

Java. Spaces/Jini n n n The “other” strategic ubiquitous Java model (contrast to EJB) Linda tuplespace model Extended work of RMI (Sun East) team Leasing, transactions and distributed event model: the programming model for Jini works similarly to CORBAServices while Java. Spaces provides server-side processing (actually fits into a separate brokering system for objects on the server side) 11/9/2020 Jini & Java. Spaces 81

EJB & Distributed Components n n We want JVM � Distributed � (networked) “Container”

EJB & Distributed Components n n We want JVM � Distributed � (networked) “Container” JVM � We have Server Container IIOP / RMI Client Container 11/9/2020 Server Container Jini & Java. Spaces 82

JINI vs Web-services n n n You expose yourself with a Java interface Only

JINI vs Web-services n n n You expose yourself with a Java interface Only the stub knows the IP address & TCP port of the remote service Registry/lookup service 11/9/2020 n n n You expose yourself with WSDL - an XML interface The WSDL includes the method descriptions but also the network location of the remote service UDDI Jini & Java. Spaces 83

Jini and UPn. P n Jini – Code movement during runtime – Service-centric n

Jini and UPn. P n Jini – Code movement during runtime – Service-centric n UPn. P – No code movement – Device-centric n Integration – UPn. P devices can be wrapped as Jini services 11/9/2020 Jini & Java. Spaces 84

Jini and Bluetooth n n Bluetooth – Open standard for wireless communication – Based

Jini and Bluetooth n n Bluetooth – Open standard for wireless communication – Based on low-cost short-range radio link – Ad-hoc connection among mobile devices – Covers both dumb and smart devices Jini and Bluetooth – For IP-based Bluetooth devices, Jini should work with no modifications – For non-IP-based Bluetooth devices, surrogate Jini services can be built 11/9/2020 Jini & Java. Spaces 85

Security Steps for Secure Remote Calls n Obtain a proxy from somewhere n Prepare

Security Steps for Secure Remote Calls n Obtain a proxy from somewhere n Prepare the proxy n – Verify that you can trust the proxy – Attach security constraints to the proxy – Grant permissions to the proxy n Make remote calls through the proxy 11/9/2020 Jini & Java. Spaces 86

Security Problem: Downloaded Code n Remote call semantics implemented by proxy n – Including

Security Problem: Downloaded Code n Remote call semantics implemented by proxy n – Including authentication What prevents a proxy from lying? n Client needs to decide if it can trust a proxy n – Before making remote calls through proxy – Before granting permissions to proxy 11/9/2020 Jini & Java. Spaces 87

Security Constraint system to express network security needs n Proxy interface to control constraints

Security Constraint system to express network security needs n Proxy interface to control constraints n Authentication tied to "JAAS Subjects" n Secure Jiniä ERI technology implementation n Mechanisms to verify trust in proxies n Dynamic permission grants to proxies n 11/9/2020 Jini & Java. Spaces 88