1JiniCMSC 4332Jini overview• Framework and services on top of Java RMI– finding services• finding registries• searching registries• keeping registries up to date– Distributed events– Transactions– JavaSpaces• Shared store3Providing ServicesLookupServicePrinterServiceProxyPrinterInterfaceregistration4Finding providersLookupServicePrinterServicePrinterProxyPrinterClientPrinterInterfacePrinterProxy5Using ServicesLookupServicePrinterServicePrinterProxyPrinterClientPrinterProxy6Proxies• Java classes that implement standardinterfaces• Classes get downloaded as needed– From http server?• Proxies can use any mechanism tocommunicate with service– RMI stubs, local computation and anycommunication medium27Lego Mindstorm Proxies• An example: Proxies for Lego Mindstormrobots• Processor on Mindstorm not powerfulenough to host a JVM• Proxy can keep state about robot,communicate through infrared link8Lookup services• Broadcast looking for lookup servicesmessages• Each lookup service on network respondswith a proxy• Queries to lookup service are done throughproxy– actual communication with lookup service is upto proxy9Using a lookup service• Can specify a list of classes/interfaces– only interested in results that are subtypes of all• Can specify attributes– Location {String building;String floor; String wing; }– must match all attributes10Service ID’s• When services first register, they areassigned a service ID– 128 GUID• a particular service using the same serviceID on all lookup services– if you get the same service back from multiplelookup services, can detect duplicates11Leasing• When a service registers with a lookupservice, it gets a limited duration lease– if lease expires without being renewed, serviceis de-listed• Service must renew lease– makes sure service is still up and still reachablefrom lookup service12Finding lookup services, revisited• When a service is activated, broadcastsrequest to find lookup services– using multicast over local net• When lookup service is activated, and atperiodic intervals, broadcasts “I’m a lookupservice”– services that learn about new lookup servicesregister with them313Example• Jini network among computers at home• Jini wireless network among my cell phone,and PDA• Don’t have to push an “I’m home” button• Next time lookup services announce “I’mhere”, networks will join14Attribute lookup• Attributes have public references for fields– no primitive types• To match– Lookup attribute must be subtype of storedattribute– Each non-null field must be equal15TO COME• Distributed events• Transactions• JavaSpaces16Transactions• Create a transaction from a transactionmanager– requires maintaining a lease• All actions performed as part of atransaction should only be visible to thattransaction– until the transaction commits17Committing a transaction• All participants are asked to prepare thetransaction– log it to persistent storage– so that it will survive crashes• Then commit– or abort18JavaSpaces• Derived from Linda TupleSpace• Store that supports transactions• Contains entry objects– i.e., records• Stored objects are leased– if lease expires, entry removed419JavaSpace operations• write - add an entry• read - find a matching entry– Can wait for matching entry (with timeout)• notify - add listening for matching entries• take - read and delete atomically20JavaSpace matching• Entry’s match just like Jini lookup attributes• Can provide don’t cares• Can use
View Full Document