JDK-8023863 : deprecate support for statically-generated stubs from RMI (JRMP)
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-08-27
  • Updated: 2020-04-06
  • Resolved: 2013-10-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b115Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The RMI/JRMP implementation generates stubs dynamically by default. This was added in Java 5. Support for statically generated stubs is no longer necessary and should be deprecated. 

Deprecation and eventual removal will proceed in three phases. This bug covers only phase 1. The other phases are described only for informational purposes and will be covered by future bug reports, and they will be implemented in future releases.

1. All APIs and runtime support having to do with static JRMP stubs will be deprecated. This bug covers just this phase.

2. The second phase covers the removal of facilities related to the development of new RMI applications that use static stubs.

3. The third and final phase includes the removal of runtime support for static JRMP stubs. This will be rather involved, as RMI internals such as DGC, the Registry, and Activation use static stubs. In addition, other parts of the JDK including JMX, JNDI, and JDI also use static stubs. All such dependencies must be removed before runtime support for static stubs can be removed.

Details of phase 1 are listed below.

The following APIs and behaviors are to be deprecated, along with a change to the default value of a system property.

A. The java.rmi.server.RemoteStub class. This class is the common superclass for all statically generated stubs, and as such, it is no longer necessary and can be deprecated. There is no replacement for this class, nor is a replacement necessary.

B. The java.rmi.server.UnicastRemoteObject.exportObject(Remote) method. This method exports a remote server object and returns an instance of a static stub class. That static stub must already exist, e.g., having been created using rmic. Applications should use the exportObject(Remote, port) method instead, which creates stubs dynamically.

C. The portion of the rmic stub compiler that supports JRMP stub and skeleton creation is to be deprecated. We may want to add a warning message to rmic that is emitted if JRMP stub creation is requested. Rmic also supports stub generation for IIOP/CORBA (using the -iiop option to rmic); this support is not deprecated as part of this effort.

D. Runtime support for JRMP skeletons and static stubs is deprecated. This behavior is not visible through any specific APIs, though use of static stubs is governed by the ignoreStubClasses system property (see below). Note, the skeleton classes themselves are already deprecated.

E. The java.rmi.server.ignoreStubClasses system property exists and currently has a default value of false. Its default value could be changed to true, which would cause APIs such as exportObject(Remote, port) not to search for static stubs before creating dynamic stubs. NOTE: this change may affect higher-level services (such as JMX, JNDI, and JDI) as well as built-in RMI services (Registry, RMID/Activation, Activation Groups, DGC) which have static stubs compiled into the platform and which may rely on static stub support to be enabled by default. (An earlier version of this proposal changed the default to true so that static stubs would be ignored. This had some compatibility issues, so the change in default has been removed from this proposal.)

This change will affect various pieces of documentation other than the java.rmi.* javadoc. External changes include:

* The rmic tool page. See JDK-8026020.

* The RMI Specification, section 3.1 and chapter 8.

* The java.rmi.server.ignoreStubClasses property is not documented on the java.rmi properties page, although it is documented in the UnicastRemoteObject javadoc. This property should be documented on the java.rmi properties page. 

Most tutorials and other documentation already seems to have been updated with information about dynamic stubs, so there is relatively little mention of static stubs remaining.

Comments
Searching the JRE for class files with the _Stub suffix gives the following list, all from rt.jar except as noted: com/sun/jndi/rmi/registry/ReferenceWrapper_Stub.class java/rmi/activation/ActivationGroup_Stub.class * javax/management/remote/rmi/RMIConnectionImpl_Stub.class * javax/management/remote/rmi/RMIServerImpl_Stub.class * javax/management/remote/rmi/_RMIConnection_Stub.class javax/management/remote/rmi/_RMIServer_Stub.class org/omg/stub/java/rmi/_Remote_Stub.class * org/omg/stub/javax/management/remote/rmi/_RMIConnection_Stub.class org/omg/stub/javax/management/remote/rmi/_RMIServer_Stub.class sun/rmi/registry/RegistryImpl_Stub.class sun/rmi/server/Activation$ActivationSystemImpl_Stub.class sun/rmi/transport/DGCImpl_Stub.class sun/jvm/hotspot/debugger/remote/RemoteDebuggerServer_Stub.class (from sa-jdi.jar) Items marked with an asterisk (*) appear in the javadoc. The stuff in org.omg is probably CORBA/IIOP related, not JRMP, but it should still be inspected in case there are any JRMP static stub dependencies there.
04-10-2013