1 / 15

CS 603 Jini

CS 603 Jini. April 10, 2002. What is Jini? Java Middleware. Tools to construct federation Multiple devices, each with Java Virtual Machine Multiple services Uses (doesn’t replace) Java RMI Adds infrastructure to support distribution Registration Lookup Security. Service.

pakuna
Download Presentation

CS 603 Jini

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 603Jini April 10, 2002

  2. What is Jini?Java Middleware • Tools to construct federation • Multiple devices, each with Java Virtual Machine • Multiple services • Uses (doesn’t replace) Java RMI • Adds infrastructure to support distribution • Registration • Lookup • Security

  3. Service • Basic “unit” of JINI system • Members provide services • Federate to share access to services • Services combined to accomplish tasks • Communicate using service protocol • Initial set defined • Add more on the fly

  4. Infrastructure:Key Components • RMI • Basic communication model • Distributed Security System • Integrated with RMI • Extends JVM security model • Discovery/join protocol • How to register and advertise services • Lookup services • Returns object implementing service (really a local proxy)

  5. Programming Model • Lookup • Leasing • Extends Java reference with notion of time • Events • Extends JavaBeans event model • Adds third-party transfer, delivery and timeliness guarantees, possibility of delay • Transaction Interfaces

  6. Jini Component Categories • Infrastructure – Base features • Programming Model – How you use them • Services – What you build Java / Jini Comparison

  7. Lookup Service • Describes functionality • Describes interface • Lookup is a service • Can be referenced in another lookup service • Also register lookup with non-Jini naming • Registering • Discovery protocol: Find a lookup service • Join protocol: Register with the lookup service

  8. Registration

  9. public class SendHelloServer implements DiscoveryListener { protected LeaseRenewalManager leaseManager = new LeaseRenewalManager(); public static void main(String argv[]) { new SendHelloServer(); // keep server running to allow time for locator // discovery and keep re-registering the lease Thread.currentThread().sleep(Lease.FOREVER); } public SendHello() { LookupDiscovery discover = null; // Prepare for discovery - empty here // Discover a lookup service // This uses the asynchronous multicast protocol, // which calls back into the discovered() method discover = new LookupDiscovery( LookupDiscovery.ALL_GROUPS); discover.addDiscoveryListener(this); } public void discovered(DiscoveryEvent evt) { ServiceRegistrar registrar = evt.getRegistrars()[0]; // At this point we have discovered a lookup service // Create information about a service ServiceItem item = new ServiceItem(null, new SendHelloImpl(), null); // Export a service ServiceRegistration reg = registrar.register(item, Lease.FOREVER); // Renew leasing leaseManager.renewUntil(reg.getLease(), Lease.FOREVER, this); } } // SendHelloServer Sample Server

  10. Invocation

  11. public class Hello { public static void main(String argv[ ]) { new Hello(); } public Hello() { LookupLocator lookup = null; ServiceRegistrar registrar = null; FileClassifier classifier = null; // Prepare for discovery lookup = new LookupLocator("jini://www.simple_stuff.com"); // Discover a lookup service // This uses the synchronous unicast protocol registrar = lookup.getRegistrar(); // Prepare a template for lookup search Class[ ] classes = new Class[ ] {SendHello.class}; ServiceTemplate template = new ServiceTemplate(null, classes, null); // Lookup a service sender = (SendHello) registrar.lookup(template); // Call the service System.out.println(sender.SendHello()); } } // Hello Sample Client

  12. Security • Principal: Authenticated user making request • Access control list: What principals can use a service • JVM security mechanisms ensure services don’t compromise local machine

  13. Leasing • Lease: Right to access a service • Guarantees access for specified time period • Negotiated as part of service protocol • Allows freeing resource by either end, without explicit negotiation • Fault tolerance • Exclusive vs. Non-exclusive • Exclusive: Non-shared resource • Non-exclusive: Allows sharing resource

  14. Transactions • Operations can be wrapped in transaction • What is done in transaction is up to operation • Notion of what “commit” or “abort” means isn’t specifiedAbort may even change state of system! • Jini provides two-phase commit protocol • Secure, fault tolerant commit / abort • No semantics enforced by Jini

  15. Events • Notification system • Object must support/define events • Other objects can register for notification • Jini handles communication / reliability issues

More Related