1 / 37

Introduction to Jini & JavaSpaces

Introduction to Jini & JavaSpaces. Source references: JGrid project. Agenda. Jini SOA Jini intro Jini detailed view Summary. Introduction to Jini. What Is Jini. Java Based SOA Platform Designed as a native extension of the J2SDK Project in Sun First announced in 1998

jensen
Download Presentation

Introduction to Jini & JavaSpaces

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. Introduction to Jini & JavaSpaces Source references: JGrid project

  2. Agenda • Jini SOA • Jini intro • Jini detailed view • Summary

  3. Introduction to Jini

  4. What Is Jini • Java Based SOA Platform • Designed as a native extension of the J2SDK • Project in Sun • First announced in 1998 • Positioned for dynamic networking

  5. UDDI Registry Find Publish WSDL Client Web Service Bind/Invoke Web Services Web Services - SOA

  6. Lookup Service Publish Find Java Interface Jini Service Client Bind/Invoke Jini Jini SOA

  7. Jini Components

  8. How does it work Find Jini Client Publish Service Registry Lookup Service Jini Service Service Proxy Bind/Invoke

  9. Jini – A Detailed view • Discovery • Registration • Lookup • Events • Leasing • Proxies

  10. Discovery request download registrar LUS proxy Unicast discovery LookupLocator lookup = null; ServiceRegistrar registrar = null; lookup = new LookupLocator(“jini://hostname”); registrar = lookup.getRegistrar(); Lookup Service Service A

  11. Discovery is initiated by class LookupDiscovery LookupDiscovery discover = new LookupDiscovery(LookupDiscovery.ALL_GROUPS); Asynchronous responses are handled by a listener object (implementing the DiscoveryListener interface) discover.addDiscoveryListener(listener); Registration public void discovered(DiscoveryEvent e){ //Lookup service discovered – register} Multicast discovery multicast request Lookup Service N Lookup Service … Discovering entity Lookup Service 2 Lookup Service 1

  12. Main steps • Discovery • Registration • Lookup • Events • Leasing • Proxies

  13. Service Proxy registration Service registration Once we have a proxy to the lookup service, can register the service ServiceRegistration registration = null; //create serviceItem (no ID, no attributes) Lookup Service ServiceItem serviceItem = new ServiceItem(null, new GreetingServiceProxy(), null); download Service A register( ) registrar try{// register for 100 seconds registration registrar.register( serviceItem, 100000L); } catch (java.rmi.RemoteException e){} LUS proxy

  14. Main steps • Discovery • Registration • Lookup • Events • Leasing • Proxies

  15. Lookup Service Template Client 1 Interface Template lookup( ) registrar Found proxy The client side // create template for service search ... GreetingServiceInterface returnedService = null; try{ returnedService = (GreetingServiceInterface) registrar.lookup(template); }catch (java.rmi.RemoteException e){ ... } returnedService.hello(); }

  16. Main steps • Discovery • Registration • Lookup • Events • Leasing • Proxies

  17. Remote Events • Jini provides remote events to make a Jini system dynamic • Services coming and going • State changes • The event mechanism is based on • Event registration • Event handling through an event listener’s notify() method

  18. Main steps • Discovery • Registration • Lookup • Events • Leasing • Proxies

  19. Obtaining a Lease • The lease grantor is usually the lookup service and the leaseholder usually is the service. ServiceRegistration reg = registrar.register(); Lease lease = reg.getLease(); • Visually this can be represented as Service A Lookup Service registrar getLease() registration lease

  20. Main steps • Discovery • Registration • Lookup • Events • Leasing • Proxies

  21. Jini service proxy models • There are several ways (patterns) of creating service proxies. • A proxy can: • Run entirely in the client JVM • Be an RMI stub • Be a proxy with local logic using RMI to the back end service • Be a proxy with local logic using its own communication protocol (e.g. socket) to the back end service • Be a wrapper to legacy code (e.g. CORBA)

  22. Introduction to JavaSpaces

  23. What is JavaSpaces? • A JINI service that provides distributed shared memory capabilities • A simple yet powerful service that can be used for solving distributed programming issues such as: • Collaboration • WorkFlow Synchronization • Distributed Computing

  24. JavaSpaces model • Write –writes a data object. • Read – reads a copy of a data object. • Take – reads a data object and deletes it. • Notify – generates an event on data updates. Write Read, Take, Notify Read, Take, Notify Write

  25. Clustered JavaSpaces

  26. JavaSpaces Methods (Space Operations) • JavaSpaces provides a basic API for storing and reading data objects in a shared resource (a space). • The methods are: • Write –writes a data object. • Read – reads a copy of a data object. • Take – reads a data object and deletes it. • Notify – generates an event on data updates.

  27. Example Entry • This shows a minimal entry: package hello; import net.jini.core.entry.Entry; public class Message implements Entry { public String content; public Message() { } } Must Implements Entry interface Entry Filed need to be public Must include a constructor

  28. Write/Read Operations • Instantiate an Entry • Set its fields as necessary • Write the entry to the space • Read an Entry Message msg = new Message(); msg.content = "Hello World"; JavaSpace space = (JavaSpace)SpaceFinder.find( “jini://*/*/JavaSpaces” ); Lease l=space.write(msg, null, Lease.FOREVER); Message template = new Message(); Template.content = “data to match”; Message result = (Message)space.read(template, null, Long.MAX_VALUE);

  29. Notify Operation • Registering for notifications // Register a notification template = space.snapshot(new Message()); EventRegistration reg = space.notify( template, null, //TX SpaceEventListener() , // The listener 60000 , // Lease null); // handbag System.out.println( "Notification registered. Registration id: " + reg.getID() + “Sequence number: " + reg.getSequenceNumber());

  30. Parallel Batch Processing Grid engine for parallel processing

  31. Monte Carlo Simulation Details • 18,000 Securities, 20 Scenarios, 2,000 Paths/Scenario • 1 run = 18K x 20 x 2K (720M) theoretically separate tasks • 1 run = 18K x 20 (360k) tasks in reality due to granularity • These larger tasks are separable • Computation time per task ranges from 20-2000 ms • Total computation time in sequence ~100 H • Setup for run takes 1-5 minutes • First pass attempts with threading on 8-way box used 56 H of elapsed time • Using the space with 50 units ~2 H (Source-Invesco)

  32. Scalability & Performance Source: Dr. Alexander Gebhart - Development ArchitectSAP – JavaOne presentation 2003

  33. Parallel Parsing Grid

  34. Provisioning & Monitoring Using the RIO project

  35. RIO Project - SLA based deployment

  36. Monitoring

  37. natis@gigaspaces.com Thank You!

More Related