Network Protocols Glossary
What is a network protocol? Protocols are the rules of the road for how data exists and moves on the network. They allow many different systems and computers to communicate.
Java RMI
What is Java RMI?
Java Remote Method Invocation is a distributed object system that enables communication between Java applications across networks. Essentially it is a mechanism that allows an object residing in one Java Virtual Machine (JVM) to invoke methods on an object running in another JVM.
What is the purpose of Java RMI
RMI leverages a client-server stub model:
- Client: The application that initiates the request to invoke a remote method.
- Server: The application hosting the remote object.
The interactions between client and server happen through:
- Stub: A local object on the client side that represents the remote object. The client interacts with this stub as if it were a local object.
- Skeleton: A local object on the server side that handles incoming method calls.
- RMI Registry: A centralized service that stores references to remote objects and allows clients to locate them.
When a client invokes a method on the stub, the stub marshals (serializes) the method call and parameters, and sends them to the server. The skeleton receives the request, unmarshals it, and invokes the actual method on the remote object. The result is then marshaled back to the client via the stub.