Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 RPCs and Naming G53ACC Chris Greenhalgh. 2 Contents l Naming principles l Advantages l Patterns of use l Implementation issues l Examples l RMI registry.

Similar presentations


Presentation on theme: "1 RPCs and Naming G53ACC Chris Greenhalgh. 2 Contents l Naming principles l Advantages l Patterns of use l Implementation issues l Examples l RMI registry."— Presentation transcript:

1 1 RPCs and Naming G53ACC Chris Greenhalgh

2 2 Contents l Naming principles l Advantages l Patterns of use l Implementation issues l Examples l RMI registry

3 3 See also: l Books: –Farley pp. 54/55 & 72/72 l Web: –sun java RMI tutorial; –CORBA naming service http://www.omg.org/cgi-bin/doc?formal/04-10-03 –Google: “Find-Bind-Execute”

4 4 Naming l A client cannot "just know" a server address in advance: –can't use fixed ports for everything (e.g. clashes in practicals) –in general addresses will be different every time –can't type in different ports every time –want meaningful names l => need a naming service

5 5 Using naming: the Find-Bind-Execute paradigm (SOAs) http://java.sun.com/developer/technicalArticles/WebServices/soa/

6 6 Advantages of Naming Services l c.f. directory enquiries c.f. DNS for hosts –Ignore low-level addressing details –Use meaningful names –Independence from (exact) location –Hide changes in low-level addresses

7 7 Using a Naming Service (i) l Before a client can do anything it must find a server object, i.e. ask naming service for an appropriate server: –right type –right location? (e.g. on the same LAN) –right instance? (e.g. mine)

8 8 Using a Naming Service (ii) l Naming service: –finds server instance, –resolves low-level address –returns "handle" or "remote reference" used to access service

9 9 Implementing a Naming Service l Use a "well known" (preconfigured) address for the naming service itself –default (well known) port number l Servers "register" their address against a particular name –creates a "binding" between the address and name l Clients "lookup" names to find server addresses

10 10 Name Server Examples l Java RMI registry l JNDI (Java Naming and Directory Interface) l Sun portmapper l ANSA trader l Windows registry (local) l X.500 (esp. LDAP) l CORBA naming service l UDDI (for Web Services)

11 11 RMI Registry Runs on a “well known” port (default 1099): > rmiregistry [ ] Runs on a “well known” port (default 1099): > rmiregistry [ ] l Implemented using RMI l Each registry maintains a flat namespace: –String  instance w. interface java.rmi.Remote l RMI URI defines a global two-level namespace –rmi://machine:port/name l Host & port  registry l Path (name)  instance in that registry –Default: rmi://localhost:1099/ –E.g. rmi://marian.cs.nott.ac.uk/MyService

12 12 RMI naming API l public class Naming { public static Remote lookup(String name) throws NotBoundException,MalformedURLException, RemoteException; public static void bind(String name, Remote obj) throws AlreadyBoundException,MalformedURLException, RemoteException; public static void unbind(String name) throws NotBoundException, MalformedURLException, RemoteException; public static void rebind(String name, Remote obj) throws MalformedURLException, RemoteException; public static String[] list(String name) throws MalformedURLException, RemoteException; }

13 13 RMI Examples l (Note static interface methods – bootstrap issue) l Register Remote server = …; Naming.rebind(":port/MyServer", server); Remote server = …; Naming.rebind(":port/MyServer", server); –N.B. only permitted on localhost for security. l Lookup –TicketServer server = (TicketServer) Naming.lookup("rmi://"+serverHost+ "/"+name); …

14 14 RMI Registry Limitations l Flat namespace –No hierarchical organisation l No federation or replication l No attributes/properties (e.g. cost, QOS) –No complex matching l Minimal security model l Problems with changing versions of interfaces and proxy implementation classes –implementation specific??


Download ppt "1 RPCs and Naming G53ACC Chris Greenhalgh. 2 Contents l Naming principles l Advantages l Patterns of use l Implementation issues l Examples l RMI registry."

Similar presentations


Ads by Google