What is RMI registry? What does it do?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Java's Remote Method Invocation (RMI) Registry is essentially a directory service.
A remote object registry is a bootstrap naming service that is used by RMI servers on the same host to bind remote objects to names. Clients on local and remote hosts can then look up remote objects and make remote method invocations.(Documentation)
You can use RMI or JNDI to bind and lookup your object remotely with rmi registry.
It's a well know use case of proxy design pattern. RMI servers register objects (essentially stubs) on RMI registry. Remote clients lookup these stubs and invoke methods on it. Behind the scene the method to be invoked, it's arguments are serialized and sent to the actual RMI server which has the implementation. RMI server (skeleton code) deserializes the request invokes actual method, collects results, deserializes it and send it back to the client (stub). Stub deserializes the results and returns it back to the code that invoked this method.
First the server associates a name with a remote object in the RMI registry. When a client wants access to a remote object it looks up the object, by its name, in the registry. Then the client can invoke methods on the remote object at the server.
http://www8.cs.umu.se/education/examina/Rapporter/471App.pdf
Essentially the RMI registry is a place for the server to register services it offers and a place for clients to query for those services. See Introduction to Java RMI. Excerpt:
RMI Registry acts a broker between RMI servers and the clients. The server "registers" its services in the registry - hence a RMI Registry can act as a "directory" for many servers/services. The client does not need to know the location of individual servers, and does a lookup on the RMI Registry for the service it needs. The registry, being a naming directory returns the appropriate handle to the client to invoke methods on.
Google around, there is plenty of info on RMI available.