The RMI protocol is implemented using the JDK standard java.rmi.*
, using blocking short connections and JDK standard serialization.
Serializable
interface-Dsun.rmi.transport.tcp.responseTimeout=3000
, see the following RMI configurationIt is a set of Java APIs that supports the development of distributed applications, and realizes the method calling of programs between different operating systems.
Starting from Dubbo 3, the RMI protocol is no longer embedded in Dubbo, and an independent module needs to be introduced separately.
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-rpc-rmi</artifactId>
<version>1.0.0</version>
</dependency>
java -Dsun.rmi.transport.tcp.responseTimeout=3000
For more RMI optimization parameters, please see JDK Documentation
If the service interface inherits the java.rmi.Remote
interface, it can interoperate with native RMI, namely:
If the service interface does not extend the java.rmi.Remote
interface:
com.xxx.XxxService$Remote
interface, inherit the java.rmi.Remote
interface, and expose the service through this interface,<dubbo:protocol name="rmi" codec="spring" />
is set, the $Remote
interface will not be generated, and the service will be exposed using Spring’s RmiInvocationHandler
interface, which is compatible with Spring.Define the RMI protocol
<dubbo:protocol name="rmi" port="1099" />
SET DEFAULT PROTOCOL
<dubbo:provider protocol="rmi" />
Set the protocol of a service
<dubbo:service interface="..." protocol="rmi" />
Multiple ports
<dubbo:protocol id="rmi1" name="rmi" port="1099" />
<dubbo:protocol id="rmi2" name="rmi" port="2099" />
<dubbo:service interface="..." protocol="rmi1" />
Spring Compatibility
<dubbo:protocol name="rmi" codec="spring" />
- If you are using RMI to provide services for external access, there should be no risk of attack in the company’s intranet environment.
- At the same time, if the application relies on the old common-collections package, dubbo will not depend on this package. Please check whether your application has used it.