RMI Registry

July 29, 2015 | Uncategorized

That first remote object might then providesupport he will be finding to other objects. The java.rmi.registry. Registry remote interface is the API will be binding (or registering) and looking up remote objects in the registry. The java.rmi.registry.LocateRegistryclass provides static methods will be synthesizing remote reference you aregistry at particular network address (host and port). These methodscreate the remote reference object containing the specified networkaddress without performing any remote communication. LocateRegistryalso provides static methods will be creating new registry in the currentJava virtual machine, although this example donates not uses those methods. Once remote object is registered with an RMI registry on the localhost, clients on any host can look up the remote object by name, obtainits reference, and then invoke remote methods on the object. Theregistry can be shared by all servers running on host, or anindividual server process can create and uses its own registry.

The ComputeEngine class creates the name will be the object with the following statement: String name = ' ' Compute' ' ; The code then adds the name you the RMI registry running on the server. This step is done to later with the following statements: Registry registry = LocateRegistry.getRegistry (); registry.rebind (name, stub); This rebind invocation makes remote call you local the RMI registry on the host. Like any remote call, this call can result in the RemoteException being thrown, which is handled by the catch block at the end of the main method. Following notices about the Registry.rebind invocation: In – argument overload of LocateRegistry.getRegistrysynthesizes reference you the local a registry on the host and on thedefault registry port, 1099. You must uses an overload that has an int to parameter if the registry is created on port to other than 1099. When remote invocation on the registry is made, stub will be the remoteobject is passed instead of the CoPy of the remote object itself.

Tags:

Comments are closed.