Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4630258

RMI-IIOP should include DGC

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.1
    • other-libs
    • x86
    • windows_2000



      Name: nt126004 Date: 01/29/2002


      FULL PRODUCT VERSION :
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      FULL OPERATING SYSTEM VERSION : Microsoft Windows 2000
      [Version 5.00.2195]

      ADDITIONAL OPERATING SYSTEMS : Solaris 2.8, HP/UX 11.0



      A DESCRIPTION OF THE PROBLEM :
      There is no provision for reference counting and/or
      distributed garbage collection in RMI-IIOP. There are a
      variety of utilities in 'regular' RMI for this purpose.
      These elements include:

          java.rmi.server.Unreferenced
          java.rmi.server.UnicastRemoteObject
          java.rmi.dgc.DGC

      It is very difficult, if not impossible, to support network
      transparency in an RMI-IIOP environment without distributed
      garbage collection. What I would like is a form of
      the "Unreferenced" interface that allows the object to
      become available for garbage collection when there are no
      more local or remote connections to the implementation.
      The leasing interface in java.rmi.dgc is of less interest
      to my origanization.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Use the Factory software design pattern to create an
      anonymous, transient, Remote object on the server.
      2. Pass this object to a remote client in the return value.
      3. Let the client drop this object on the floor so that the
      stub gets garbage collected locally.
      4. As you repreat this process, unused copies of the object
      implementation accumulate on the server.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public interface GenericClient extends Remote {
      }
      -----------
      public class GenericClientImpl extends DgcClientImpl
      implements GenericClient {

          private GenericFactory factory = null ;
          
          public GenericClientImpl() throws Exception {
              Context lNameService = new InitialContext() ;
              this.factory = (GenericFactory)
      PortableRemoteObject.narrow(
                  lNameService.lookup
      (GenericFactory.GENERIC_FACTORY),
                  GenericFactory.class);
              this.factory.registerClient(this) ;
          }

          public int makeObject( int inSize ) throws
      RemoteException {
              GenericObject lObject = this.factory.makeObject(
      inSize ) ;
              return lObject.getSize() ;
          }
          
      }
      -----------
      public interface GenericFactory extends Remote {
          String GENERIC_FACTORY = "GenericFactory" ;
          GenericObject makeObject( int inSize ) throws
      RemoteException ;
      }
      -----------
      public class GenericFactoryImpl extends PortableRemoteObject
          implements GenericFactory
      {
          public GenericFactoryImpl() throws RemoteException {
          }

          public GenericObject makeObject(int inSize) throws
      RemoteException {
              return new GenericObjectImpl(inSize) ;
          }

      }
      -----------
      public interface GenericObject extends DgcUnicastObject {
          int getSize() throws RemoteException ;
      }
      -----------
      public class GenericObjectImpl extends DgcUnicastObjectImpl
          implements GenericObject
      {
          private byte[] array = null ;
          
          protected GenericObjectImpl(int inSize) throws
      RemoteException {
              this.array = new byte[ inSize ] ;
          }
        
          public int getSize() throws RemoteException {
              return this.array.length ;
          }
          
      }

      ---------- END SOURCE ----------
      (Review ID: 137575)
      ======================================================================

            hputtaswsunw Hemanth Puttaswamy (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: