RMI (Remote Method Invocation) model is a distributed object application. Using RMI technology, an object in one JVM can call an object method in another JVM and obtain the call result. The other JVM here can be on the same computer or a remote computer. Therefore, RMI means that a Server and a Client are required.
RMI port introduction
The Server usually creates an object and makes it accessible remotely.
This object is called a remote object.
The server needs to register this object so that it can be accessed remotely by the client.
The client calls methods on objects that can be accessed remotely, and the client can communicate with the server and transfer information to each other.
Speaking of this, have you found that using RMI is very convenient when building a distributed application? Like RPC, it can realize mutual communication between distributed applications, and it is even very similar to the current microservice idea. .
Advantages and disadvantages of RMI
Advantages: It can avoid reinventing the wheel;
Disadvantages: The calling process is very slow, and the process is unreliable and prone to unpredictable occurrences Errors, such as network errors, etc.
The above is the detailed content of What is rmi in java. For more information, please follow other related articles on the PHP Chinese website!